Libraries

Step 1: Loading Reflectance Data

suppressMessages({
  # File pathway linking to the reflectance data for Thraupidae specimens on laptop
  #ddPath <- "C:\\Users\\proto\\OneDrive\\Documents\\tanager_spec\\tanager_spec\\RefDataSpeciesSummary_MatchingMF\\data"
  
  # File pathway linking to the reflectance data for Thraupidae specimens on PC
  ddPath <- "C:\\Users\\batra\\Documents\\tanager_spec\\tanager_spec\\data\\RefDataSpeciesSummary_MatchingMF"

  # Reads in all of .csv files
  dat <- pblapply(list.files(ddPath, full=T), read.csv)
  # Extracts all of the wavelengths and turns it into a vector
  wl <- dat[[1]][, 1]
  # Removes the wavelength column from each of the species' data frames
  dat <- sapply(dat, "[", -1)
  
  # Takes the reflectance data from each patch available for each species 
  # Combines reflectance data with wavelength vector ranging from 300-700 nm
  specs <- as.rspec(cbind(wl, do.call(cbind, dat)), lim=c(300, 700))
  # Turns all negative reflectance values in data frame to 0
  specs <- procspec(specs, fixneg="zero")
  
  # Creates a data frame with just male specimens
  male_specs <- specs %>% select(!ends_with("f"))
  
  # Creates a data frame from the male specimen data frame using only 
  # the crown patch of the bird
  crown_data <- male_specs %>%
    select(wl, starts_with("Crown_")) %>%
    rename_with(~ gsub("m$", "", .)) %>%
    rename_with(~ gsub("^Crown_", "", .))
  
  # Finds the rgb hex code for each of the crown patches
  rgb_colors <- spec2rgb(crown_data)
  # Adds names of the species to each hex color code
  names(rgb_colors) <- names(crown_data)[-1]
  
  # Verifies that data frame has been created correctly
  head(crown_data)
})
##    wl   AcaBai    AniIgn   AniLac    AniMel   AniNot   AniSom   BanArc   BanAur
## 1 300 2.356690 1.1447721 11.39746  8.896685 4.535676 2.014334 5.533874 3.126775
## 2 301 1.903805 0.8218703 12.11596  8.899757 5.386252 1.444982 4.656108 3.745577
## 3 302 1.777677 0.3635018 12.44752  9.508270 6.579554 1.646972 4.473581 4.624964
## 4 303 1.956667 0.5506667 12.46547  9.872667 6.587833 1.983947 4.986000 4.196333
## 5 304 2.086104 0.5410315 12.57834  9.691481 6.914120 2.683912 5.666046 5.145111
## 6 305 2.553706 0.9282766 12.29238 10.253288 7.446329 2.923659 5.490410 6.381721
##      BanEdw   BanMel   BanRot   ButAur    ButExi ButMon   ButWet CalCoc
## 1 1.4074342 2.792863 2.720081 12.36975  9.853977      0 1.940090      0
## 2 0.8987856 2.613824 2.721775 12.86508  9.873162      0 2.141559      0
## 3 1.0957351 2.701293 2.913748 13.68989 10.111072      0 2.995856      0
## 4 1.6188667 2.551333 2.243000 13.83140 10.321933      0 2.810667      0
## 5 2.0386333 2.740259 1.734444 13.45717 10.115626      0 3.157426      0
## 6 2.5069297 3.211658 1.078811 14.04848 10.483344      0 3.042622      0
##     CamHel   CamPal   CamPar   CamPau   CamPsi   CatAna   CatDia   CatHom
## 1 3.469025 6.643459 2.719078 5.499726 2.579595 4.518847 2.219834 5.587705
## 2 3.036942 7.602843 3.744938 5.698823 3.010506 4.336070 2.382877 6.276141
## 3 2.725917 7.989854 4.219054 5.927595 3.078775 4.244808 2.497530 6.854827
## 4 2.889133 7.241067 3.745280 5.383200 3.367667 3.862467 1.883267 6.427067
## 5 3.143063 6.617119 3.128248 5.333707 3.731115 4.145883 2.269567 5.481470
## 6 3.869150 6.013214 3.264869 5.477861 3.516852 4.021309 1.918708 6.225052
##     CatIno   CerOli   ChaEuc   ChlCal ChlNit   ChlPho   ChlRie   ChlSpi
## 1 3.008490 1.597151 5.387928 2.630297      0 1.787583 2.784198 1.612941
## 2 2.616133 1.730229 6.023412 3.474346      0 2.044171 3.276139 1.277324
## 3 3.294292 2.450377 6.458176 3.473768      0 1.696432 3.689607 1.380377
## 4 4.443133 2.863067 6.054750 3.991000      0 2.461333 4.117933 1.372000
## 5 3.437819 2.587056 5.016699 3.586952      0 3.661704 4.370585 1.306522
## 6 5.182589 2.042841 5.806554 3.673250      0 3.939279 4.340295 1.892305
##     ChrChr   ChrSal   CisLev   CneRub   CoeFla   ComBae   ComGar   ComLor
## 1 1.949883 4.471500 6.664564 4.975148 3.760420 4.967959 1.844345 4.560399
## 2 2.329393 4.400425 6.275407 4.706490 4.126041 5.326747 2.188339 4.799556
## 3 2.523396 4.784778 6.921449 5.457355 4.167218 4.105865 1.724850 5.719318
## 4 2.792556 4.523722 6.041067 6.047067 4.111000 3.140896 2.095556 5.047583
## 5 2.816093 3.580108 6.493004 6.208793 4.068874 3.156895 2.492580 4.814028
## 6 2.818090 3.429653 6.855703 6.840187 4.819775 2.791245 2.552961 4.056009
##     ConAlb   ConBic   ConCin    ConFer   ConLeu   ConMar   ConRuf   ConSit
## 1 10.46993 2.015616 3.804209 1.9168577 2.578745 4.845310 3.141086 2.525085
## 2 10.12310 1.258997 3.714779 1.8302739 2.849072 4.560984 2.548177 2.491962
## 3 10.40977 1.210195 3.284392 0.9475532 3.220024 4.541942 2.517834 2.725701
## 4 11.18733 1.583111 3.498333 0.9898000 2.851333 4.683467 2.070467 2.394800
## 5 11.26497 1.388296 4.440231 1.8609481 2.321988 4.088907 2.744841 2.564296
## 6 12.11861 1.712550 4.598439 1.9402180 1.952958 3.663535 2.913573 2.412890
##     ConSpa ConSpm   ConTam   CorCuc   CorMel   CorPil   CreDen   CreVer
## 1 3.358489      0 3.412506 6.490117 4.495232 10.35447 2.840637 4.538499
## 2 3.709069      0 3.201041 7.144863 4.478360 10.73900 2.686527 4.503564
## 3 3.925063      0 3.037099 7.932816 4.588965 10.93741 1.949874 4.403225
## 4 4.112333      0 3.636267 7.416467 4.771722 12.02407 1.951083 5.057800
## 5 4.758173      0 4.172085 7.681907 5.639179 10.85867 1.922611 4.922030
## 6 4.390084      0 4.023079 7.862213 5.623269 10.67903 1.630532 5.197043
##     CyaCae   CyaCys   CyaLuc   CyaNit    CyiCyi   CypHir   DacAlb   DacBer
## 1 47.82842 41.49798 23.52521 36.24909  9.682599 3.422173 30.74110 10.52712
## 2 48.71184 42.43106 24.20018 37.04390 10.122437 3.426750 30.94648 11.42346
## 3 49.29641 43.49012 24.71517 37.55738 10.289468 3.745732 31.15261 10.78989
## 4 49.57293 44.47547 24.95913 37.89383 10.688333 3.887600 31.72800 11.02356
## 5 50.42770 45.24845 25.83192 39.48137 10.758269 3.550522 32.22233 11.77883
## 6 50.60203 45.97401 26.38695 40.60357 10.539698 3.741910 32.99691 11.63292
##     DacCay    DacFla   DacLin   DacNig   DacVen   DacVig   DelCas   DigAlb
## 1 16.62614  7.034602 22.20075 20.04237 24.05480 20.14063 12.71208 5.808184
## 2 17.32347  7.183602 22.53657 20.95381 24.02077 20.86264 13.64604 5.711144
## 3 17.80806  8.018494 23.07261 20.84107 23.55332 21.15301 13.70460 5.501305
## 4 18.50593  8.506333 24.06907 20.39833 23.70200 21.38573 13.86287 5.799800
## 5 19.93100  9.992485 24.85467 20.41631 24.27682 21.83977 14.96010 6.483400
## 6 19.51759 10.959667 26.11854 21.03806 24.74464 22.36942 15.42640 6.707083
##     DigBar   DigBru   DigCae   DigCar   DigCya   DigDui   DigGla     DigGlo
## 1 6.442543 5.176213 4.761571 3.826953 10.33006 7.791004 12.56828 0.00000000
## 2 5.508182 5.402843 5.634023 3.892699 10.60421 8.172086 12.80130 0.00000000
## 3 5.339232 5.436029 5.975823 2.957868 10.81254 7.808751 12.78159 0.03230631
## 4 4.667250 5.552800 6.400200 3.486667 11.47007 6.575733 13.07420 0.00000000
## 5 5.529088 5.609878 6.701107 4.228474 11.73469 6.108693 13.32874 0.41992963
## 6 5.729264 5.660191 6.361795 3.445634 12.32895 5.910584 13.70849 0.95878018
##     DigGls   DigHum   DigInd   DigLaf   DigMaj   DigMys    DigPlu   DigSit
## 1 5.911885 5.315526 3.912009 4.740884 5.746431 6.459852  9.968993 7.514505
## 2 5.905845 5.477690 3.296104 5.007212 5.998514 5.987995 10.236485 8.075579
## 3 6.023903 5.611667 3.129428 4.902143 6.072998 6.033641 11.279784 7.875029
## 4 6.213250 5.820533 2.860333 5.006771 6.509533 6.716333 11.134667 8.076500
## 5 6.421384 6.156630 2.969861 4.906539 5.850556 6.852841 11.711237 7.907699
## 6 6.629507 6.380209 3.943491 4.563189 5.928620 7.607613 12.199932 7.886867
##     DigVen   DiuDiu   DiuSpe   DolFri   DonAlb    DubTae   EmbDui   EmbHer
## 1 4.413730 5.754768 4.513088 5.628032 4.645562  9.388712 1.686559 4.040586
## 2 4.292516 6.051697 4.685247 6.604378 5.038362  9.714932 2.270955 3.951989
## 3 4.044523 5.380742 4.342351 7.106216 4.673121 10.139378 1.531207 3.911493
## 4 3.733833 4.769333 4.060133 6.991333 4.297933 10.404267 3.147333 4.198333
## 5 4.270157 3.463952 4.665000 6.549444 3.256133 10.792793 3.227259 3.965176
## 6 4.472887 2.724789 4.475528 5.723248 2.586216 10.657593 3.542144 4.317468
##     EmbLon   EmbPla   EmbYpi    EucPen    EunCam   GeoCon   GeoDif   GeoFor
## 1 2.338532 4.269550 4.909153 0.4650937  8.777310 4.302198 4.160865 5.656685
## 2 3.439315 3.636867 4.307609 0.8571243  9.311593 3.814930 4.490456 5.751912
## 3 3.362640 4.218802 3.409551 1.2577694 10.058741 4.273697 4.224193 6.028177
## 4 3.698667 3.939067 4.183800 1.4741333 10.300400 3.505800 4.474000 6.035600
## 5 3.461648 3.932163 5.405856 1.1612111 11.166744 3.235274 4.708181 6.405648
## 6 3.409676 4.654184 6.260063 0.9784072 10.824191 3.115571 4.505560 6.617688
##     GeoFul   GeoMag   GeoSca   GubCri   HapRus   HapUni   HemAtr   HemCal
## 1 6.448760 6.531546 4.561547 7.380761 4.582564 7.463453 2.444315 1.789450
## 2 5.698004 7.064521 4.258554 6.909324 5.085793 7.039780 2.618054 1.943099
## 3 5.313429 7.979640 4.555024 6.311311 5.553897 8.032144 2.213946 2.463144
## 4 5.100000 8.089267 3.589333 6.047167 5.761733 8.117767 2.134833 2.643067
## 5 4.763537 8.176015 3.280883 5.714065 5.783456 8.154983 2.177606 3.226993
## 6 5.055092 7.564323 2.848854 6.350489 5.951241 7.519610 1.680514 3.041022
##     HemFla HemFro   HemGoe   HemGui   HemMel    HemPar HemPiu   HemRey   HemRuc
## 1 3.287751      0 5.605915 3.379796 3.736193 3.1149820      0 1.266595 4.524636
## 2 3.218171      0 5.699159 3.965413 3.895222 3.4821216      0 1.997243 4.850843
## 3 2.946195      0 4.831592 4.463416 3.758582 1.4672354      0 2.621126 5.460076
## 4 2.740067      0 4.679933 4.512533 3.976467 0.9297917      0 3.241667 5.154133
## 5 2.694589      0 4.609824 4.911848 4.363937 0.8993449      0 3.903537 3.785207
## 6 2.550214      0 4.942499 3.846759 4.760578 1.1250101      0 4.106505 3.929441
##     HemRus   HemSup   HemTri   HemVer   HemXan   HetRub   HetXan   IdiBra
## 1 2.502548 2.098243 3.904831 3.234018 3.045542 6.152712 4.228811 3.312871
## 2 2.309180 1.753862 4.316602 3.620662 2.942859 6.544171 4.682160 3.618069
## 3 2.877843 2.183583 5.085332 4.342088 3.038568 6.654640 4.674836 4.216775
## 4 3.275933 2.895000 5.113800 4.343833 3.104200 6.115667 4.887733 4.643333
## 5 3.262852 2.984352 5.068830 4.830097 3.556463 6.642037 4.921104 4.764395
## 6 3.059625 3.220811 5.025465 5.040315 3.916326 6.796928 4.661458 4.698480
##     IncLae   IncOrt   IncPer   IncPul   IncWat   IriAna   IriJel   IriPor
## 1 4.414038 5.292791 2.551869 3.270497 4.785303 5.771081 3.992751 4.377826
## 2 3.989401 6.119745 2.390995 3.248391 5.037771 5.888508 4.252169 3.813357
## 3 4.258971 6.272973 2.418378 3.395009 5.340468 6.093108 4.324804 4.009715
## 4 3.983333 6.503333 2.145333 3.724733 5.192800 5.781933 4.280600 4.185222
## 5 3.982542 6.122935 1.942009 4.036441 5.664348 5.276085 4.193115 4.397148
## 6 4.378187 5.115919 2.175338 4.137515 5.404914 4.974350 4.235859 4.410030
##     IriPul    IriRei   IriRuf   LanAur   LanFul    LanLeu   LanVer   LopGri
## 1 2.556881 1.6641640 2.398438 1.711784 2.155905  6.806644 1.875807 4.396759
## 2 2.662247 1.6932523 2.305449 2.010827 2.309213  8.114988 1.914119 4.427661
## 3 2.329413 1.1432036 2.183699 1.496450 2.127450  8.692264 2.270701 4.317014
## 4 2.325067 1.1347333 2.418600 1.369267 1.809733  9.683662 2.384200 3.895667
## 5 2.009063 1.2780593 3.164674 1.538796 1.728348 10.244642 2.234641 3.910170
## 6 1.805400 0.9912414 3.542218 1.353515 1.455249  9.401372 2.153353 4.449196
##     LopPus   LoxAno   LoxNoc    LoxPor   LoxVio   MelMel   MelNig   MelRic
## 1 7.488234 3.910953 3.112941 0.7241694 3.978859 6.290421 3.317616 2.663009
## 2 7.728872 3.611694 3.302369 0.5207532 3.494323 6.346495 3.616895 2.822505
## 3 8.120056 3.903131 3.412677 0.4182378 2.825022 5.101267 3.853908 2.791955
## 4 8.777200 3.814917 3.506333 0.8708667 2.716667 4.902100 3.827133 1.614333
## 5 9.125893 3.826162 3.245481 0.7432741 2.436115 4.756217 4.466144 2.336722
## 6 9.077670 4.258948 2.971335 0.7415405 2.341905 4.632594 4.545243 2.238441
##     MelXan   NemPil   NeoFas   NepOne   NesAcu   OrcAbe   OreFra   OryAng
## 1 3.227230 4.226787 5.055903 2.750476 4.476550 4.686505 4.003340 4.710562
## 2 3.053802 4.427649 5.578859 2.984126 4.927500 5.367763 4.011671 4.578402
## 3 3.187752 5.991195 5.745822 3.277987 5.451937 6.685174 3.800905 4.211364
## 4 3.999750 6.571733 5.922933 4.008067 5.517333 5.427667 4.056417 3.453000
## 5 4.214352 6.875541 6.054052 3.772852 5.130167 5.959997 4.003097 3.298693
## 6 3.863957 7.280532 5.968306 3.802959 5.445279 5.704658 3.699477 3.357095
##     OryCra   OryFun   OryMax   OryNut   ParCap   ParCor   ParDom   ParGul
## 1 7.429500 3.171680 2.478050 3.547213 3.131365 2.192040 3.488714 5.262649
## 2 7.114906 1.696083 2.238608 3.181813 3.250432 1.692593 3.211316 5.341650
## 3 6.791849 1.783286 2.637338 3.065804 2.936459 1.480622 2.503977 5.598689
## 4 6.554433 2.014250 2.274000 3.493822 2.827667 1.769867 2.564167 5.632500
## 5 6.204209 1.687894 2.008000 2.797590 2.573741 2.164226 3.877600 5.221044
## 6 6.324417 2.340734 2.263856 3.435716 1.892505 2.509106 4.650066 5.927428
##     ParHum   ParNig    PhrAla   PhrAtr   PhrCar   PhrDor   PhrEry   PhrFru
## 1 1.291459 2.886041  9.293345 3.329982 4.506378 5.958768 5.393117 4.035439
## 2 1.470869 3.250788  9.722730 3.493220 4.852748 6.540127 5.173101 3.700482
## 3 2.591761 3.799027  9.971624 3.316380 5.439523 7.434704 5.215481 3.711192
## 4 3.333333 3.780667 10.363583 3.523467 5.290667 6.914625 5.228400 4.010433
## 5 1.288852 4.100083 11.004463 3.808385 6.077074 7.631400 5.338504 4.176483
## 6 2.063306 3.766527 11.143282 4.008009 5.946428 7.364779 5.950004 4.193376
##     PhrPat   PhrPle   PhrPun   PhrUni   PieCin   PinIno   PipMel   PlaCra
## 1 5.918407 4.492483 4.337694 4.419768 4.849804 7.595793 44.03170 4.935750
## 2 4.687977 4.608919 4.675339 4.146243 5.063029 7.981541 45.27175 4.996324
## 3 3.553551 4.704658 4.880333 4.382067 5.183631 6.137357 46.54217 5.160751
## 4 3.805467 4.587800 4.570267 4.332867 5.437083 5.480333 46.97613 5.289200
## 5 4.819904 4.487626 4.711126 3.984511 5.364856 4.238993 47.44355 5.450237
## 6 5.570063 4.528342 4.649456 4.118596 5.041036 3.369950 47.98022 5.174789
##     PooAlt   PooBol   PooCab   PooCae   PooCin   PooEry   PooHis   PooHyp
## 1 2.659149 5.074505 3.147468 1.979581 3.787056 7.712095 2.747193 4.714058
## 2 3.038234 4.900971 3.120582 2.135532 4.244384 7.609276 2.777488 4.660856
## 3 3.145950 4.980750 3.085348 2.241360 4.363910 7.682692 2.762346 4.884816
## 4 3.486833 5.398733 3.029067 2.709000 4.223600 7.945467 2.773867 5.114267
## 5 3.895370 5.529215 3.251222 3.093833 4.675441 8.458844 3.236433 4.961119
## 6 3.539613 5.523874 3.204924 2.964775 4.821710 8.432375 3.034631 4.787085
##     PooMel   PooNig   PooOrn   PooTho   PooTor   PooWhi   PorCae   PyrRuf
## 1 11.26016 5.275041 5.698532 4.047944 1.994281 6.175694 8.884247 2.985196
## 2 11.80131 5.415951 5.689101 4.329250 2.436692 6.643366 9.345823 2.704384
## 3 11.56038 5.513935 4.807838 4.291748 3.602207 6.608038 9.545780 3.434103
## 4 11.83930 4.856200 3.447583 4.118200 3.506933 6.874067 9.865067 3.132467
## 5 10.55111 3.877707 4.733398 4.123044 3.973230 6.915759 9.460619 4.185693
## 6  9.37007 4.818914 4.960957 4.444984 3.475429 6.550272 9.483804 3.727236
##      RamBre    RamCar     RamCos    RamDim    RamFla   RamMel    RamNig
## 1 3.8178378 0.6575369 0.00000000 0.0000000 0.0000000 2.373670 0.8585081
## 2 1.7594474 1.2629982 0.00000000 0.4934586 0.0000000 2.212339 0.7717676
## 3 2.2941652 1.8017676 0.03942703 0.9421703 0.1915694 1.945461 1.1554324
## 4 0.7708889 2.4197333 0.28406667 1.0868333 0.0000000 1.657600 1.4081333
## 5 0.5567407 2.7865519 0.34956667 0.8162907 0.2692222 1.029870 1.4319370
## 6 2.3220991 2.3640991 0.31947207 0.3772622 0.0000000 1.078897 1.7661766
##     RamPas   RamSan   RhoCru   SalAlb     SalAte   SalAto   SalAtp   SalAur
## 1 2.092480 1.107279 5.267655 3.915486 0.00000000 4.418674 3.056477 4.420184
## 2 1.974804 1.321750 5.313646 3.759941 0.00000000 4.314685 2.939376 4.057112
## 3 1.886745 1.813571 5.048610 4.188431 0.00000000 4.326058 2.848426 4.018236
## 4 1.575917 2.131267 4.617833 3.978600 0.00000000 3.803733 2.996133 3.447733
## 5 1.236782 2.613637 4.703222 3.953630 0.04198148 3.729526 3.649130 3.590822
## 6 1.318827 2.669377 4.916980 4.746939 0.53640541 3.898820 3.974416 4.002832
##     SalCin   SalCoe    SalFul   SalGro   SalMal   SalMam   SalMul   SalNig
## 1 3.168025 4.004351 1.0794342 5.033497 5.002832 5.334402 15.74235 3.370532
## 2 2.839908 3.822681 1.0258180 4.819243 4.476708 5.543121 16.62963 3.105339
## 3 3.011948 3.490829 0.5417351 4.965391 4.330586 5.199097 15.40084 3.240399
## 4 3.607250 3.170400 2.0172667 4.799333 4.866000 4.940267 15.30760 3.271667
## 5 3.169894 3.324511 2.5264296 4.767463 6.317667 5.091256 14.95960 3.644216
## 6 3.618851 3.915580 2.5987027 4.726150 6.961162 5.189872 14.91429 4.024294
##     SalOre   SalRuf   SalSim   SalStr   SchMel   SchRuf   SerAlb   SicAur
## 1 5.463356 5.274351 4.474921 6.131899 4.324312 4.449703 14.00662 8.577032
## 2 7.085903 5.478189 4.156344 6.256351 4.736539 5.146381 14.34296 8.028575
## 3 6.254764 5.436554 4.238843 6.078312 4.933793 5.448093 14.93730 7.989236
## 4 5.441367 4.852167 4.596400 6.137133 4.674733 5.316222 15.42970 6.809067
## 5 5.154061 5.456111 4.878281 6.368189 5.512852 5.474654 16.32746 5.878826
## 6 4.032126 5.520279 5.259483 6.556189 5.823301 5.291928 16.89555 6.798753
##     SicCit   SicCol   SicFla   SicLeb   SicLua    SicLuc   SicLuo   SicLuv
## 1 11.25139 7.205077 2.830766 7.648045 4.676791 0.1021811 5.362960 5.264173
## 2 12.29999 7.287677 3.230378 7.145766 5.741486 0.2458739 5.011879 5.571210
## 3 12.99739 7.838106 4.078973 8.224568 6.527688 0.6680757 4.439155 4.883621
## 4 13.91120 6.471133 4.317333 7.508000 6.496067 1.2284667 4.784400 3.816833
## 5 14.09174 7.217593 4.263859 7.562741 5.551548 1.5280704 5.216737 3.680078
## 6 14.09012 6.273910 4.061829 7.912486 5.579627 1.6636676 5.659854 3.144914
##     SicOli   SicRai   SicTac   SicUro   SpoAlb   SpoAme   SpoArd    SpoBoe
## 1 5.204306 6.755234 4.564286 3.310614 4.268679 2.761505 3.879212 0.2185383
## 2 5.255086 6.567703 4.546519 3.668602 4.282187 3.020553 4.298396 1.2393041
## 3 5.441187 5.799820 4.824760 4.187177 4.633883 3.492620 4.489554 1.7047027
## 4 5.620867 6.934000 4.833533 4.504667 4.380400 3.838067 3.044667 1.8463333
## 5 5.716030 8.905722 5.345681 4.650185 4.569707 2.745678 2.185917 1.6927407
## 6 6.155941 8.194748 5.210966 4.254263 4.497658 2.635780 1.390338 1.2230000
##     SpoBoo    SpoCae   SpoCas   SpoCin   SpoCol   SpoCor   SpoFro    SpoHyc
## 1 4.993282 1.9897946 4.061829 6.635216 4.723308 4.821036 4.289338 10.106671
## 2 4.729613 1.4693568 3.707445 7.844453 4.328332 5.098705 3.536815  9.856275
## 3 4.072123 1.2005856 3.342933 8.342039 4.142750 7.214793 2.711018 10.156014
## 4 4.578778 0.9673333 3.272533 8.349444 4.217000 6.789800 3.588333 10.500500
## 5 5.105025 1.6696407 3.542422 8.371451 3.992930 7.721230 2.995056 10.530398
## 6 5.205201 1.9081766 3.553863 8.365844 4.160517 6.525811 3.909784 10.799360
##     SpoHyx    SpoIna   SpoInt    SpoLeu   SpoLin   SpoLuc   SpoMin   SpoNic
## 1 9.887982 11.759180 4.064547 13.144916 5.005912 4.448468 4.661175 5.567274
## 2 9.209042 10.563775 4.201367 12.932435 4.390182 4.509087 5.045897 5.589960
## 3 9.126309  9.028432 3.419466 12.430396 3.883852 4.325381 5.108537 5.457667
## 4 9.069533  9.184333 3.452333 10.863333 4.033333 4.926000 5.080867 5.027067
## 5 7.520901  9.913889 3.455208  9.510302 3.316396 4.462105 5.410693 5.467456
## 6 8.636017 11.347477 3.394881  9.717895 3.347627 4.186982 5.259308 6.098886
##     SpoPer   SpoPlu   SpoRuf   SpoSch   SpoSim   SpoTor   SteDia   TacCor
## 1 3.483946 5.242597 4.825178 5.069198 5.544849 3.914820 41.60987 4.836622
## 2 3.227615 5.732869 4.247578 5.417510 5.466721 4.728831 41.75434 5.258086
## 3 3.497984 6.309418 2.992063 5.246964 5.149845 4.435311 42.64125 5.863616
## 4 3.149917 6.454133 2.951133 5.253867 5.456667 3.899500 44.07067 6.663067
## 5 3.446389 6.809431 3.171059 5.042793 5.492134 3.539630 45.07088 6.291722
## 6 3.981626 6.210236 3.725485 4.817861 5.919448 2.797162 46.70900 6.223065
##     TacCri   TacDel   TacLuc    TacPho   TacRuf   TacRuv   TacSur   TanArg
## 1 1.640398 8.762058 3.119652 0.7513315 8.583155 2.088650 1.789730 2.427432
## 2 1.815859 8.307054 3.777277 1.2612685 7.230387 1.740654 1.856085 2.181986
## 3 1.351065 7.036616 4.345204 1.2830036 4.991850 2.443249 1.607371 3.051023
## 4 1.128133 7.506867 3.852400 0.8894667 3.590933 3.159267 1.926733 2.819000
## 5 1.416974 7.649233 3.349419 0.5677444 2.922400 3.260626 1.982904 3.043611
## 6 1.414360 7.682982 3.427677 0.4146937 3.382674 3.840914 1.735825 3.130450
##     TanArt   TanCal   TanCay   TanChi   TanChr   TanCuc   TanCya   TanCyc
## 1 1.467633 3.939865 2.766577 1.546768 1.677360 5.353996 12.85256 24.99214
## 2 1.070534 4.167627 3.157926 2.042294 1.524777 4.903018 12.69680 25.51809
## 3 1.602883 4.549110 3.320213 2.138168 1.414596 5.572593 13.72460 26.39848
## 4 1.291167 4.865400 3.444867 2.011733 1.588752 6.040467 14.50273 26.02467
## 5 1.602079 5.802404 3.449726 2.003015 1.498061 5.336267 14.47962 26.77763
## 6 1.876052 6.399480 3.999852 2.592816 1.696240 6.013441 15.54088 28.33923
##     TanCyo   TanCyp     TanCyv   TanDes    TanDow   TanFas   TanFlo   TanFuc
## 1 4.685744 4.894128 1.53088288 3.585494  8.093189 7.288550 2.364691 4.202508
## 2 3.982295 5.122881 0.39092793 3.767771  7.414797 8.486483 2.275387 4.517622
## 3 4.159786 5.076450 0.01966066 3.400597  8.021703 9.367165 2.907186 4.599910
## 4 3.679571 5.279167 0.00000000 2.275361  7.958667 9.500778 3.105667 4.445889
## 5 3.799271 5.238824 0.00000000 2.683393  9.429824 8.347049 2.306123 5.335204
## 6 4.048019 5.988795 0.00000000 2.766825 11.963306 7.516703 2.475210 5.514745
##     TanGut   TanGyr   TanHei   TanIct   TanIno   TanJoh    TanLab   TanLar
## 1 4.829768 3.375108 4.754764 1.661829 4.501844 5.236825  8.742186 7.501444
## 2 4.057305 3.741441 4.464932 1.760623 4.582871 5.657435 10.544344 7.244984
## 3 3.251351 3.843132 3.552948 2.138634 4.196477 6.356735  9.801495 7.059277
## 4 3.480000 4.533933 3.714467 2.309267 4.342778 5.917067 10.277800 7.178000
## 5 3.814641 4.747278 1.882696 2.231774 4.564636 5.688391  9.468952 7.093171
## 6 3.383431 4.935061 1.599903 2.125413 4.895985 6.643610  9.604049 7.036554
##     TanLav   TanMex   TanMey   TanNic   TanNiv   TanPal   TanPar   TanPer
## 1 2.290441 2.827105 2.478378 21.84156 8.460319 11.34139 4.762243 5.691432
## 2 2.309212 3.017802 2.591824 22.41399 8.460668 11.56592 4.895393 6.298126
## 3 2.189450 2.984490 3.343730 23.14435 8.719510 12.82801 5.003978 6.256604
## 4 1.683000 3.178200 3.253833 23.55653 8.946267 13.70775 5.038467 6.772000
## 5 1.570694 3.372519 3.030491 24.11456 8.996733 13.53459 5.232363 6.668056
## 6 2.021892 3.450267 3.097725 25.70736 9.022232 14.43345 5.463470 5.572568
##      TanPre   TanPun   TanRue   TanRuf   TanRuu   TanSch    TanSel   TanVar
## 1  9.944220 6.008441 5.002063 3.424358 6.909399 1.863059 10.139715 3.795550
## 2  9.816647 6.111986 5.386405 2.702604 6.704295 1.906650  9.674646 3.480396
## 3 10.643818 6.772058 4.987523 2.554797 6.862164 1.649207  9.437048 3.359012
## 4 10.704467 7.040267 4.996000 2.483500 6.317833 1.751800 10.165000 3.968000
## 5 10.522515 7.286067 5.009926 2.402514 6.948602 1.717885 10.715284 4.519877
## 6 10.092454 7.242719 5.891712 2.773025 6.433117 1.826332 11.083459 5.116051
##     TanVas   TanVel   TanVir    TanVit   TanXac   TanXag   TerVir   ThlFul
## 1 2.090986 3.547241 5.851671 0.0000000 3.319324 5.198502 22.83156 6.217622
## 2 1.932000 3.829730 5.830550 0.0000000 3.283024 5.814634 23.48568 5.804049
## 3 1.741870 3.966005 5.949300 0.3065514 3.626273 6.880012 23.79442 6.021079
## 4 2.395533 4.065520 6.169000 0.3940000 3.822667 7.266778 25.07140 6.482333
## 5 3.007759 4.212550 6.293051 0.7635556 3.874549 7.289660 25.85069 6.294207
## 6 3.461418 4.419631 6.829633 0.8666216 4.072607 7.429174 26.23603 6.344178
##     ThlIno   ThlOrn   ThlPec   ThlRuf   ThlSor   ThrAbb   ThrBon   ThrCya
## 1 4.137212 4.018599 4.602153 4.298849 2.225132 16.54398 17.06939 23.94336
## 2 4.004766 4.506939 5.335471 4.226583 2.187126 16.95915 17.37653 23.97398
## 3 4.393178 5.093394 5.356084 4.089910 2.317160 17.08833 18.18349 24.66325
## 4 3.961167 5.019833 5.259889 3.864750 2.380533 17.96227 19.00967 26.03373
## 5 3.180060 4.355625 5.754611 3.825542 2.680167 18.30083 19.33483 26.94218
## 6 3.277047 4.366608 4.740420 3.410989 3.460623 18.89690 19.63418 27.52753
##     ThrCyp   ThrEpi    ThrGla   ThrOrn   ThrPal   ThrSay    TiaBic   TiaCan
## 1 11.77104 15.70287 11.164295 26.62071 11.45043 7.734886 0.8755788 5.133854
## 2 12.07851 15.92114 12.126169 26.56315 11.98017 7.490996 1.3769189 5.877162
## 3 11.92041 16.61791 11.888736 27.70014 12.96002 8.468750 2.1457500 6.069865
## 4 10.88247 17.18853 10.780833 29.30667 13.44800 9.263733 3.4594167 5.848733
## 5 11.06614 17.83998  9.608986 28.68717 13.98219 9.005744 3.1475093 5.876067
## 6 10.79618 17.93138  8.779264 28.67975 14.47977 9.377237 2.8914527 5.991153
##     TiaFul   TiaObs   TiaOli   TriMel   UroSto   VolJac   WetSte   XenCon
## 1 1.579715 4.562836 2.961937 4.663139 4.309291 4.797721 2.685617 6.996423
## 2 2.509440 4.996505 2.660923 4.703391 4.823276 4.793861 2.610338 7.475644
## 3 3.427998 6.191164 3.325404 5.140431 4.588535 5.222081 3.710387 6.674491
## 4 4.815200 5.576417 3.770933 5.100200 4.847111 5.361533 4.143833 6.251667
## 5 4.468637 6.331551 3.296244 4.975270 5.256043 5.136441 3.369602 5.716065
## 6 4.154216 6.832324 3.227438 4.348146 5.330523 4.315382 3.279829 5.451829
##     XenPar
## 1 11.79418
## 2 12.58418
## 3 12.37302
## 4 12.37817
## 5 13.14826
## 6 13.42591

Step 2: Extracting tanager tree

get the tanagers only

# File pathway linking to the Thraupidae tree on laptop
#treepath <- "C:\\Users\\proto\\OneDrive\\Documents\\tanager_spec\\tanager_spec\\data\\MCC_Tree_SpNames.nex"

# File pathway linking to the Thraupidae tree on PC
treepath <- "C:\\Users\\batra\\Documents\\tanager_spec\\tanager_spec\\data\\MCC_Tree_SpNames.nex"

# Reads Thraupidae tree into R
tt <- read.nexus(treepath)

# Extract the tip labels (species names) from the tree
tan_species <- grep("^Tan", tt$tip.label, value = TRUE)

# Find the MRCA node of the species that start with "Tan"
mrca_node <- getMRCA(tt, tan_species)

# Extract the subtree from the MRCA node
tanagerTree <- extract.clade(tt, mrca_node)

# Plot the tanagerTree
p <- ggtree(tanagerTree) +
  geom_tiplab(size = 2.5, align = TRUE) +
  theme_tree2()

# Display the plot
print(p)

# Creates a NEXUS tree file into working directory
write.nexus(tanagerTree, file = "tanagerTree.NEXUS")

Step 3: Create a Data Frame Matching the Tanager Tree

# Extract the species names (tip labels) from the tanagerTree
tanager_species <- tanagerTree$tip.label

# Filter crown_data to include only species that are present in tanagerTree
tanData_filtered <- crown_data %>%
  select(wl, any_of(tanager_species))

# Display the filtered tanData to verify data frame created correctly
head(tanData_filtered)
##    wl   TanCyo    TanLab   TanRue   TanChi   TanVel   TanCal   TanMex   TanIno
## 1 300 4.685744  8.742186 5.002063 1.546768 3.547241 3.939865 2.827105 4.501844
## 2 301 3.982295 10.544344 5.386405 2.042294 3.829730 4.167627 3.017802 4.582871
## 3 302 4.159786  9.801495 4.987523 2.138168 3.966005 4.549110 2.984490 4.196477
## 4 303 3.679571 10.277800 4.996000 2.011733 4.065520 4.865400 3.178200 4.342778
## 5 304 3.799271  9.468952 5.009926 2.003015 4.212550 5.802404 3.372519 4.564636
## 6 305 4.048019  9.604049 5.891712 2.592816 4.419631 6.399480 3.450267 4.895985
##      TanSel   TanFas   TanCyc     TanCyv   TanDes   TanChr   TanXac   TanSch
## 1 10.139715 7.288550 24.99214 1.53088288 3.585494 1.677360 3.319324 1.863059
## 2  9.674646 8.486483 25.51809 0.39092793 3.767771 1.524777 3.283024 1.906650
## 3  9.437048 9.367165 26.39848 0.01966066 3.400597 1.414596 3.626273 1.649207
## 4 10.165000 9.500778 26.02467 0.00000000 2.275361 1.588752 3.822667 1.751800
## 5 10.715284 8.347049 26.77763 0.00000000 2.683393 1.498061 3.874549 1.717885
## 6 11.083459 7.516703 28.33923 0.00000000 2.766825 1.696240 4.072607 1.826332
##     TanJoh   TanArt   TanIct   TanFlo   TanPar   TanLav   TanGyr   TanVas
## 1 5.236825 1.467633 1.661829 2.364691 4.762243 2.290441 3.375108 2.090986
## 2 5.657435 1.070534 1.760623 2.275387 4.895393 2.309212 3.741441 1.932000
## 3 6.356735 1.602883 2.138634 2.907186 5.003978 2.189450 3.843132 1.741870
## 4 5.917067 1.291167 2.309267 3.105667 5.038467 1.683000 4.533933 2.395533
## 5 5.688391 1.602079 2.231774 2.306123 5.232363 1.570694 4.747278 3.007759
## 6 6.643610 1.876052 2.125413 2.475210 5.463470 2.021892 4.935061 3.461418
##     TanNiv   TanFuc    TanDow   TanRuu   TanPun   TanXag   TanGut   TanVar
## 1 8.460319 4.202508  8.093189 6.909399 6.008441 5.198502 4.829768 3.795550
## 2 8.460668 4.517622  7.414797 6.704295 6.111986 5.814634 4.057305 3.480396
## 3 8.719510 4.599910  8.021703 6.862164 6.772058 6.880012 3.251351 3.359012
## 4 8.946267 4.445889  7.958667 6.317833 7.040267 7.266778 3.480000 3.968000
## 5 8.996733 5.335204  9.429824 6.948602 7.286067 7.289660 3.814641 4.519877
## 6 9.022232 5.514745 11.963306 6.433117 7.242719 7.429174 3.383431 5.116051
##     TanPal    TanVit   TanCuc   TanCay    TanPre   TanNic   TanCya   TanLar
## 1 11.34139 0.0000000 5.353996 2.766577  9.944220 21.84156 12.85256 7.501444
## 2 11.56592 0.0000000 4.903018 3.157926  9.816647 22.41399 12.69680 7.244984
## 3 12.82801 0.3065514 5.572593 3.320213 10.643818 23.14435 13.72460 7.059277
## 4 13.70775 0.3940000 6.040467 3.444867 10.704467 23.55653 14.50273 7.178000
## 5 13.53459 0.7635556 5.336267 3.449726 10.522515 24.11456 14.47962 7.093171
## 6 14.43345 0.8666216 6.013441 3.999852 10.092454 25.70736 15.54088 7.036554
##     TanCyp   TanVir   TanHei   TanArg   ThrCyp   ThrAbb   ThrPal   ThrOrn
## 1 4.894128 5.851671 4.754764 2.427432 11.77104 16.54398 11.45043 26.62071
## 2 5.122881 5.830550 4.464932 2.181986 12.07851 16.95915 11.98017 26.56315
## 3 5.076450 5.949300 3.552948 3.051023 11.92041 17.08833 12.96002 27.70014
## 4 5.279167 6.169000 3.714467 2.819000 10.88247 17.96227 13.44800 29.30667
## 5 5.238824 6.293051 1.882696 3.043611 11.06614 18.30083 13.98219 28.68717
## 6 5.988795 6.829633 1.599903 3.130450 10.79618 18.89690 14.47977 28.67975
##     ThrSay   ThrEpi   TanRuf
## 1 7.734886 15.70287 3.424358
## 2 7.490996 15.92114 2.702604
## 3 8.468750 16.61791 2.554797
## 4 9.263733 17.18853 2.483500
## 5 9.005744 17.83998 2.402514
## 6 9.377237 17.93138 2.773025
# Verifies that there are 0 species in data frame that should not be there
(names(tanData_filtered[-1]) == tanager_species)
##  [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [46] TRUE TRUE TRUE TRUE TRUE TRUE
# Verifies that there are not any species have not been added to data frame
length(names(tanData_filtered[-1])) == length(tanager_species)
## [1] TRUE

Step 4: Fitting Cubic Splines to the Tanager Reflectance and Log-Transformed Reflectance Data

Website that explains what splines are: https://community.jmp.com/t5/JMPer-Cable/Understanding-cubic-splines/ba-p/39511

### Step 3: Fitting Cubic Splines to Tanager reflectance data

 # Function to fit a natural spline and a cubic spline, returning the models, coefficients, and goodness-of-fit metrics
  fit_splines <- function(wl, reflectance) {
    # Fit cubic splines to base reflectance data with 38 degrees of freedom (35 knots)
    # We use gls instead of lm, as our error structure fails the independence assumption
    # corAR1 was the error structure recommended for us to use
    # When using the corAR1 function, the argument value pertains to the type of autocorrelation present in the
    # corAR1 autocorrelation structure (at any given point, we only care about the autocorrelation of the next
    # surrounding point {x, x+1}).
    # For corAR1, I leave the 'value' argument at 0, given that it does not change any of the coefficient values
    # or the model score values. I will note that the error structure performs better (+ values) 
    # and worse (- values) at non-zero values, although I am unsure if this has any noteworthy
    # benefits to optimize. I need to talk to Professor Marc Suchard to clarify if leaving
    # it at the default of zero is acceptable.
    # With the form argument, I used form = ~ 1, form = ~ 300:700, and form = ~ wl,
    # and each produced identical results, so I will stick with the default of 
    # form = ~ 1 unless told otherwise.
    # For the final argument ('fixed'), fixed = TRUE produces lower residual standard
    # error values, but the model score performs lower than when fixed = FALSE.
    # I think this another question that needs to be asked as to which is better,
    # but for now, I will keep the default as fixed = FALSE.
    cubic_spline_fit_reflectance <- gls(reflectance ~ bs(wl, df = 38), correlation = 
                                          corAR1(form = ~ 1))

    
    # bs function contains data that is not added to the gls model
    # This includes degree of the functions used, the placement of the
    # boundary and internal knots, and the basis matrix of the wavelengths.
    # It is important to note that when working with trait data, we want to 
    # use the same basis matrix to preserve the same "trait space" (need to clarify
    # if this the correct thinking) between species. Thus, we make sure to keep the
    # same range of wavelength when proceeding forward (300-700 nm).
    basis_spline_data <- bs(wl, df = 38)
    
    # Extract coefficients from each set of fits
    reflectance_coef <- round(coef(cubic_spline_fit_reflectance), 2)
    
    # Calculate goodness-of-fit metrics (AIC, BIC, and logLik values)
    reflectance_AIC <- summary(cubic_spline_fit_reflectance)$AIC

    reflectance_BIC <- summary(cubic_spline_fit_reflectance)$BIC

    reflectance_logLik <- summary(cubic_spline_fit_reflectance)$logLik

    # Extracts rspec and rgb values from the reflectance curves
    reflectance_rspec <- as.rspec(data.frame(wl = wl, reflectance = 
                         predict(cubic_spline_fit_reflectance)), lim = c(300, 700))
    reflectance_rgb <- spec2rgb(reflectance_rspec)
    
    # Generate a list containing all of our pulled data
    return(list(
      reflectance_spline_fit = cubic_spline_fit_reflectance,
      reflectance_coef = reflectance_coef,
      reflectance_AIC = reflectance_AIC,
      reflectance_BIC = reflectance_BIC,
      reflectance_logLik = reflectance_logLik,
      reflectance_rgb = reflectance_rgb,
      degree = attributes(basis_spline_data)$degree,
      internal_knots = attributes(basis_spline_data)$knots,
      boundary_knots = attributes(basis_spline_data)$Boundary.knots
    ))
  }

# Function to fit a natural spline and a cubic spline, returning the models, coefficients, and goodness-of-fit metrics
  fit_splines_log <- function(wl, reflectance) {

    # Fit cubic spline to log-transformed reflectance values with 38 degrees of freedom (35 knots)
    cubic_spline_fit_log_reflectance <- gls((reflectance) ~ bs(wl, df = 38), correlation
                                            = corAR1(form = ~ 1))
    
    # bs function contains data that is not added to the gls model
    # This includes degree of the functions used, the placement of the
    # boundary and internal knots, and the basis matrix of the wavelengths.
    basis_spline_data <- bs(wl, df = 38)
    
    # Extract coefficients from each set of fits
    log_reflectance_coef <- round(coef(cubic_spline_fit_log_reflectance), 2)
    
    # Calculate goodness-of-fit metrics (AIC, BIC, and logLik values)
    log_reflectance_AIC <- summary(cubic_spline_fit_log_reflectance)$AIC
    
    log_reflectance_BIC <- summary(cubic_spline_fit_log_reflectance)$BIC

    log_reflectance_logLik <- summary(cubic_spline_fit_log_reflectance)$logLik

    # Extracts rspec and rgb values from the reflectance curves
    log_reflectance_rspec <- as.rspec(data.frame(wl = wl, reflectance = 
                          predict(cubic_spline_fit_log_reflectance)), lim = c(300, 700))
    log_reflectance_rgb <- spec2rgb(log_reflectance_rspec)
    
    # Generate a list containing all of our pulled data
    return(list(
      log_reflectance_spline_fit = cubic_spline_fit_log_reflectance,
      log_reflectance_coef = log_reflectance_coef,
      log_reflectance_AIC = log_reflectance_AIC,
      log_reflectance_BIC = log_reflectance_BIC,
      log_reflectance_logLik = log_reflectance_logLik,
      log_reflectance_rgb = log_reflectance_rgb,
      degree = attributes(basis_spline_data)$degree,
      internal_knots = attributes(basis_spline_data)$knots,
      boundary_knots = attributes(basis_spline_data)$Boundary.knots
    ))
  }
  
  
  # Here we need to make a separate data frame for our log-transformed data
  # This is to convert any values less than 1 to 1 to avoid Inf/NaN errors during 
  # our log-transformation of the reflectance data

  # Creates a separate data frame for only log-transformed data
  tanlogData_filtered <- tanData_filtered
  
  # Nested for loop to turn all data points < 1 into 1 to prevent any Inf/NaN errors
  for (i in 2:52){
    y <- as.numeric(i)
    for (j in 1:401){
      x <- as.numeric(j)
      matrix_position <- tanlogData_filtered[x,y]
      if (tanlogData_filtered[x,y] < 1){
        tanlogData_filtered[x,y] <- 1
      }
       else if (tanlogData_filtered[x,y] >= 1){
        tanlogData_filtered[x,y] <- matrix_position
       }
    }
}

  
  # This log-transforms every value in our data frame
  tanlogData_filtered <- log(tanlogData_filtered)
  # This converts our wavelength data back to standard values
  # (300-700 nm)
  tanlogData_filtered$wl <- exp(tanlogData_filtered$wl)

  # Apply the spline fitting function to each species
  spline_results <- lapply(tanData_filtered[-1], function(reflectance) {
    fit_splines(tanData_filtered$wl, reflectance)
  })

# Applies our spline fitting function to our log-transformed reflectance data for
# each species
  spline_results_log <- lapply(tanlogData_filtered[-1], function(reflectance) {
    fit_splines_log(tanlogData_filtered$wl, reflectance)
  })

Step 5: Species plots of splines on refl. and log refl. data

# Function that plots the splines from each dataset for all species
plot_splines_with_metrics <- function(species_name, wl, reflectance, log_reflectance, spline_results, spline_results_log, rgb_colors) {
  
  # Extracts a single species spline results from each dataset list
  result <- spline_results[[species_name]]
  log_result <- spline_results_log[[species_name]]
  
  par(mfrow = c(1, 2))
  
  # Plots Cubic Splines for Reflectance Data with model scores
plot(wl, reflectance, type = "p", pch = 16, cex = 0.5,  # Adjusted size of points
     col = adjustcolor("black", alpha.f = 0.5),  # Adjusted transparency of points
     main = paste("Cubic Splines (Refl.) -", species_name),
     xlab = "Wavelength (nm)", ylab = "Reflectance (%)")
lines(wl, predict(result$reflectance_spline_fit), col = rgb_colors[[species_name]], lwd = 2)
mtext(paste("AIC:", round(result$reflectance_AIC, 3), "BIC:", round(result$reflectance_BIC, 2), "logLik:", round(result$reflectance_logLik)),
      side = 3, line = 0.5, cex = 0.8, col = "blue")

# Plots Cubic Splines for log Reflectance data with model scores
plot(wl, log_reflectance, type = "p", pch = 16, cex = 0.5,  # Adjusted size of points
     col = adjustcolor("black", alpha.f = 0.5),  # Adjusted transparency of points
     main = paste("Cubic Spline (log Refl.) -", species_name),
     xlab = "Wavelength (nm)", ylab = "log Reflectance (%)")
lines(wl, predict(log_result$log_reflectance_spline_fit), col = rgb_colors[[species_name]], lwd = 2)
mtext(paste("AIC:", round(log_result$log_reflectance_AIC, 3), "BIC:", round(log_result$log_reflectance_BIC, 2), "logLik:", round(log_result$log_reflectance_logLik)),
      side = 3, line = 0.5, cex = 0.8, col = "blue")
}

# Takes above function and uses a for loop to get every species' spline results plotted
for (species_name in names(spline_results)) {
  plot_splines_with_metrics(species_name, tanData_filtered$wl, tanData_filtered[[species_name]], tanlogData_filtered[[species_name]], spline_results, spline_results_log, rgb_colors)
}

# Takes the above plots and puts them onto a pdf
pdf("cubic_splines_refl&logrefl_with_metrics.pdf", width = 12, height = 8)
for (species_name in names(spline_results)) {
  plot_splines_with_metrics(species_name, tanData_filtered$wl, tanData_filtered[[species_name]], tanlogData_filtered[[species_name]], spline_results, spline_results_log, rgb_colors)
}
dev.off()
## png 
##   2

Step 6: Print a Summary Table of Spline Fits

# Create the spline summary table with coefficients, degree,
# knot placements, rgb values, and goodness-of-fit metrics.
# data frame just extracts data from the species list data from 
# each of the respective spline results
spline_table <- data.frame(
  
  Species = names(spline_results),

  Reflectance_Spline_Coefficients = sapply(spline_results, function(x) paste(x$reflectance_coef, collapse = ", ")),
  Log_Reflectance_Spline_Coefficients = sapply(spline_results_log, function(x) paste(x$log_reflectance_coef, collapse = ", ")),
  
  Reflectance_AIC = sapply(spline_results, function(x) round(x$reflectance_AIC, 2)),
  Log_Reflectance_AIC = sapply(spline_results_log, function(x) round(x$log_reflectance_AIC, 2)),  

  Reflectance_BIC = sapply(spline_results, function(x) round(x$reflectance_BIC, 2)),
  Log_Reflectance_BIC = sapply(spline_results_log, function(x) round(x$log_reflectance_BIC, 2)),

   Reflectance_logLik = sapply(spline_results, function(x) round(x$reflectance_logLik, 2)),
  Log_Reflectance_logLik = sapply(spline_results_log, function(x) round(x$log_reflectance_logLik, 2)),

  Degree_Reflectance = sapply(spline_results, function(x) c(x$degree)),
  Degree_Log_Reflectance = sapply(spline_results_log, function(x) c(x$degree)),
  
  RGB_Color = sapply(spline_results, function(x) c(x$reflectance_rgb))
  )


# Adding Internal Knots to the spline_table but I perform this outside of 
# the data frame function as there are some complications with inserting those
# values through the methodology we see below. This method, although an additional
# step, circumvents the necessity of adding each indiviual knot (for each species)
# as an individual column in the data frame

# Extracts the internal and boundary knot placements for each species 
# as a matrix for the splines using reflectance data
Internal_Knots = sapply(spline_results, function(x) round(c(x$internal_knots), 3))
Internal_Knots_log = sapply(spline_results_log, function(x) round(c(x$internal_knots), 3))

Boundary_Knots = sapply(spline_results, function(x) round(c(x$boundary_knots),3))
Boundary_Knots_log = sapply(spline_results_log, function(x) round(c(x$boundary_knots), 3))

# We must transpose the matrix to make the species names align along the rows
# to easily bind this matrix to the spline_table
Internal_Knots <- t(Internal_Knots)
Internal_Knots_log <- t(Internal_Knots_log)

Boundary_Knots <- t(Boundary_Knots)
Boundary_Knots_log <- t(Boundary_Knots_log)

# Attaching each matrix to each our spline_table
spline_table <- cbind(spline_table, Internal_Knots)
spline_table <- cbind(spline_table, Internal_Knots_log)
spline_table <- cbind(spline_table, Boundary_Knots)
spline_table <- cbind(spline_table, Boundary_Knots_log)


# 4 for loops to add each set of knot data into a singular column
# in our spline_table data frame. Check knot vector min and max values
# to ensure your for loops do not take values from a different knot 
# dataset.

# Adds our new column
spline_table$Internal_Knots <- NA

# For loop to turn knots into a long character string
# and inputs it into our newly generated column for
# each species
for (i in 1:51){
  x <- c(spline_table[i,13:47])
  x <- as.numeric(x)
  spline_table[i,87] <- toString(x)
}


spline_table$Internal_Knots_log <- NA
for (i in 1:51){
  x <- c(spline_table[i,48:82])
  x <- as.numeric(x)
  spline_table[i,88] <- toString(x)
}

spline_table$Boundary_Knots <- NA
for (i in 1:51){
  x <- c(spline_table[i, 83:84])
  x <- as.numeric(x)
  spline_table[i,89] <- toString(x)
}

spline_table$Boundary_Knots_log <- NA
for (i in 1:51){
  x <- c(spline_table[i, 85:86])
  x <- as.numeric(x)
  spline_table[i,90] <- toString(x)
}

# Removes all extraneous knot columns
spline_table <- spline_table[,-c(13:86)]

# Verifying Knot Placements

# Only a single value should be printed if the internal knots are
# placed at the same points
unique(spline_table$Internal_Knots)
## [1] "311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889"
unique(spline_table$Internal_Knots_log)
## [1] "311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889"
# Making sure internal knot placements are identical between 
# reflectance and log reflectance data
unique(spline_table$Internal_Knots) == unique(spline_table$Internal_Knots_log)
## [1] TRUE
# Only a single value should be printed if the boundary knots are
# placed at the same points
unique(spline_table$Boundary_Knots)
## [1] "300, 700"
unique(spline_table$Boundary_Knots_log)
## [1] "300, 700"
# Making sure boundary knot placements are identical between 
# reflectance and log reflectance data
unique(spline_table$Boundary_Knots) == unique(spline_table$Boundary_Knots_log)
## [1] TRUE
# Verifying Degree of our Cubic Splines

# Only a single value should be printed if the is uniform
# This value should be 3, given we are using cubic splines
unique(spline_table$Degree_Reflectance)
## [1] 3
unique(spline_table$Degree_Log_Reflectance)
## [1] 3
# Making sure the degree of the splines are identical between 
# reflectance and log reflectance data
unique(spline_table$Degree_Reflectance) == unique(spline_table$Degree_Log_Reflectance)
## [1] TRUE
# Remove row names
rownames(spline_table) <- NULL

# Display the table in the document without row names
kable(spline_table, caption = "Summary of Spline Fits for Each Species (Including Goodness-of-Fit)") %>%
  kable_styling(bootstrap_options = "striped", full_width = F)
Summary of Spline Fits for Each Species (Including Goodness-of-Fit)
Species Reflectance_Spline_Coefficients Log_Reflectance_Spline_Coefficients Reflectance_AIC Log_Reflectance_AIC Reflectance_BIC Log_Reflectance_BIC Reflectance_logLik Log_Reflectance_logLik Degree_Reflectance Degree_Log_Reflectance RGB_Color Internal_Knots Internal_Knots_log Boundary_Knots Boundary_Knots_log
TanCyo 4.69, -1.95, 2.17, 0.58, 2.96, 2.43, 1.04, 2.21, 1.82, 1.93, 1.81, 2.03, 2, 2.36, 2.73, 3.21, 3.87, 4.33, 4.68, 5.22, 5.37, 5.47, 5.42, 5.15, 5.21, 4.48, 4.25, 3.78, 3.03, 2.75, 2.14, 2.17, 2.39, 1.74, 1.88, 1.28, 2.3, 1.5, 2.08 1.54, -0.44, 0.46, 0.08, 0.52, 0.4, 0.22, 0.39, 0.33, 0.34, 0.33, 0.36, 0.36, 0.41, 0.46, 0.52, 0.6, 0.65, 0.69, 0.75, 0.76, 0.77, 0.77, 0.74, 0.75, 0.67, 0.65, 0.59, 0.5, 0.46, 0.38, 0.38, 0.41, 0.32, 0.34, 0.24, 0.4, 0.28, 0.37 -447.30 -1746.10 -287.74 -1586.54 264.65 914.05 3 3 #52574BFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanLab 8.74, 3.72, -5.3, 1.19, -2.37, -3.35, -3.7, -4.4, -4.37, -3.82, -3.39, -3.2, -2.93, -2.16, -1.96, -1.35, -0.52, 0.41, 0.81, 2.97, 3.67, 4.39, 5.24, 5.24, 5.53, 5.12, 4.02, 3.55, 2.66, 2.07, 1.9, 1.99, 0.71, 0.99, 2.1, 0.76, 3.98, 1.55, 2.86 2.17, 0.42, -0.65, 0.14, -0.3, -0.49, -0.56, -0.7, -0.69, -0.57, -0.49, -0.46, -0.41, -0.28, -0.25, -0.16, -0.06, 0.05, 0.09, 0.3, 0.35, 0.41, 0.47, 0.47, 0.49, 0.46, 0.38, 0.34, 0.27, 0.21, 0.2, 0.21, 0.08, 0.11, 0.21, 0.09, 0.38, 0.17, 0.28 94.04 -1354.85 253.60 -1195.29 -6.02 718.42 3 3 #686446FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanRue 5, 0.82, -0.09, -0.08, 0.15, 0.26, 0.46, 1.22, 2.11, 2.34, 2.73, 2.91, 3.06, 3.45, 3.88, 4.91, 5.62, 7.54, 8.41, 11.13, 13.4, 16.33, 18.65, 20.66, 21.7, 20.51, 18.01, 14.92, 11.61, 9.33, 7.5, 6.52, 5.85, 5.63, 4.63, 4.8, 4.96, 4.76, 4.96 1.61, 0.15, -0.02, -0.03, 0.04, 0.05, 0.09, 0.22, 0.35, 0.38, 0.44, 0.46, 0.48, 0.52, 0.58, 0.69, 0.76, 0.92, 0.99, 1.18, 1.31, 1.46, 1.55, 1.64, 1.68, 1.63, 1.53, 1.39, 1.21, 1.06, 0.92, 0.83, 0.77, 0.76, 0.66, 0.67, 0.69, 0.67, 0.69 -160.62 -1470.60 -1.06 -1311.05 121.31 776.30 3 3 #7B804EFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanChi 1.55, 1.35, -0.19, 1.46, 0.56, 0.57, 0.57, 0.69, 1.05, 1.26, 0.99, 0.73, 0.39, 0.37, 0.46, 0.26, 0.38, 0.95, 0.5, 0.3, 7.54, 34.96, 46.12, 56.4, 64.09, 65.77, 61.82, 52.02, 40.41, 30.95, 23.94, 19.55, 17.1, 15.73, 13.86, 13.96, 12.72, 12.91, 12.59 0.44, 0.71, -0.09, 0.7, 0.3, 0.32, 0.3, 0.36, 0.53, 0.59, 0.5, 0.39, 0.23, 0.22, 0.26, 0.16, 0.2, 0.54, 0.16, 0.47, 2.19, 3.23, 3.41, 3.64, 3.74, 3.77, 3.71, 3.55, 3.31, 3.06, 2.81, 2.62, 2.49, 2.42, 2.3, 2.3, 2.22, 2.23, 2.21 -261.07 -998.58 -101.51 -839.03 171.53 540.29 3 3 #C9AB00FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanVel 3.55, 1.24, 0.14, 0.04, 0.4, 0.06, 0.67, -0.29, -0.08, 0.18, 0.1, 0.54, 0.76, 1.55, 2.23, 3.07, 3.71, 4.1, 3.68, 2.89, 2.1, 1.38, 1.08, 0.88, 0.9, 0.91, 0.78, 0.98, 0.78, 0.95, 0.8, 1.17, 0.97, 1.25, 0.99, 1.26, 1.52, 1.57, 1.5 1.27, 0.32, 0.03, 0.01, 0.1, 0.02, 0.18, -0.08, -0.03, 0.05, 0.03, 0.14, 0.2, 0.37, 0.49, 0.63, 0.72, 0.77, 0.71, 0.6, 0.47, 0.33, 0.27, 0.22, 0.23, 0.23, 0.2, 0.24, 0.2, 0.24, 0.2, 0.29, 0.24, 0.3, 0.25, 0.3, 0.36, 0.36, 0.35 -667.03 -1691.01 -507.48 -1531.45 374.52 886.51 3 3 #3D3E44FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanCal 3.94, 2.11, 0.78, 2.27, 2.31, 3.22, 3.33, 3.9, 4.91, 5.57, 6.93, 10.17, 14.3, 19.43, 23.33, 26.77, 30.07, 34.12, 37.03, 42.26, 47.17, 52.55, 58.67, 64.55, 71.77, 76.04, 79.95, 81.57, 80.83, 78.42, 75.67, 70.98, 66.98, 61.25, 57.57, 51.81, 49.36, 45.43, 45.78 1.37, 0.45, 0.18, 0.45, 0.46, 0.6, 0.61, 0.69, 0.81, 0.88, 1.03, 1.29, 1.55, 1.79, 1.94, 2.06, 2.16, 2.27, 2.34, 2.46, 2.56, 2.66, 2.77, 2.86, 2.96, 3.01, 3.06, 3.08, 3.07, 3.04, 3.01, 2.95, 2.89, 2.81, 2.75, 2.65, 2.61, 2.53, 2.54 -209.85 -1636.12 -50.30 -1476.56 145.93 859.06 3 3 #FFCD80FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanMex 2.83, 0.4, 1.14, -1.12, 1.19, 0.19, 1.09, 0.74, 1.22, 1.4, 0.89, 1.52, 1.24, 1.46, 1.33, 1.5, 1.51, 1.61, 1.45, 1.67, 1.63, 1.61, 1.65, 1.62, 1.76, 1.8, 1.65, 1.71, 1.73, 1.89, 1.7, 2.03, 1.66, 2.46, 1.71, 2.76, 1.65, 3.07, 2.37 1.04, 0.11, 0.45, -0.52, 0.44, 0.04, 0.35, 0.22, 0.37, 0.4, 0.28, 0.43, 0.36, 0.42, 0.39, 0.43, 0.43, 0.45, 0.42, 0.46, 0.45, 0.45, 0.46, 0.45, 0.48, 0.49, 0.46, 0.47, 0.48, 0.51, 0.47, 0.54, 0.46, 0.63, 0.48, 0.69, 0.47, 0.74, 0.61 -469.41 -1269.97 -309.85 -1110.42 275.70 675.99 3 3 #433A37FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanIno 4.5, -0.17, 1.54, 1.37, 3.12, 1.65, 2.08, 2.76, 2.61, 3.16, 3.62, 3.69, 4.02, 4.32, 4.43, 4.68, 4.91, 5.22, 4.93, 5.49, 5.4, 5.64, 5.55, 5.59, 6.14, 6.06, 6.35, 6.31, 6.66, 6.84, 6.76, 7.22, 7.48, 7.47, 7.64, 8.39, 7.75, 7.75, 8.11 1.5, -0.03, 0.3, 0.27, 0.54, 0.31, 0.38, 0.48, 0.46, 0.53, 0.59, 0.6, 0.64, 0.67, 0.69, 0.71, 0.74, 0.77, 0.74, 0.8, 0.79, 0.81, 0.8, 0.81, 0.86, 0.85, 0.88, 0.88, 0.91, 0.93, 0.92, 0.96, 0.98, 0.98, 0.99, 1.05, 1, 1, 1.03 -358.02 -1780.64 -198.46 -1621.09 220.01 931.32 3 3 #685851FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanSel 10.14, 0.48, -0.39, -1.98, -0.77, -0.22, 1.23, 2.27, 4.01, 5.47, 7.28, 8.73, 10.17, 11.94, 13.88, 16.97, 19.81, 24.55, 28.93, 32.19, 42.23, 56.28, 68.51, 77.13, 84.59, 85.11, 76.92, 59.14, 40.28, 25.72, 16.94, 10.84, 8.34, 5.91, 5.71, 3.58, 3.87, 4.09, 4.35 2.32, 0.04, -0.04, -0.22, -0.08, -0.02, 0.12, 0.2, 0.34, 0.43, 0.54, 0.62, 0.7, 0.78, 0.86, 0.98, 1.09, 1.23, 1.35, 1.43, 1.65, 1.89, 2.05, 2.15, 2.24, 2.24, 2.15, 1.94, 1.62, 1.28, 0.99, 0.73, 0.6, 0.46, 0.45, 0.3, 0.32, 0.34, 0.36 -238.06 -2065.73 -78.50 -1906.18 160.03 1073.87 3 3 #CBDC79FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanFas 7.29, 2.22, -1.14, -2.47, -0.73, 0.45, -0.08, 2.47, 3.68, 5.14, 7.63, 9.48, 11.99, 14.67, 16.96, 19.94, 23.31, 27.66, 31.49, 39.55, 49.44, 59.84, 70, 76.74, 82.1, 77.82, 66.36, 49.67, 36.19, 24.73, 19.33, 14.54, 12.52, 9.87, 8.77, 7.8, 7.01, 6.86, 6.44 1.99, 0.25, -0.11, -0.44, -0.08, 0.05, 0, 0.3, 0.41, 0.54, 0.72, 0.83, 0.98, 1.1, 1.2, 1.32, 1.44, 1.57, 1.68, 1.87, 2.06, 2.22, 2.36, 2.45, 2.51, 2.46, 2.32, 2.07, 1.8, 1.49, 1.3, 1.1, 1, 0.86, 0.79, 0.73, 0.67, 0.66, 0.63 98.41 -1318.24 257.96 -1158.68 -8.20 700.12 3 3 #BCD97BFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanCyc 24.99, 1.44, 12.01, 16.24, 15.92, 13.42, 10.85, 11.62, 9.11, 9.11, 9.69, 11.87, 13.25, 15.95, 17.54, 18.18, 17.98, 16.12, 12.61, 9.53, 5.6, 1.9, -1.34, -4.14, -6.23, -9.34, -10.8, -12.2, -13.75, -13.48, -14.67, -14.99, -15.89, -14.3, -14.59, -16.94, -15.01, -16, -14.96 3.22, 0.07, 0.41, 0.5, 0.5, 0.43, 0.36, 0.38, 0.31, 0.31, 0.33, 0.39, 0.43, 0.49, 0.53, 0.55, 0.54, 0.5, 0.41, 0.32, 0.21, 0.08, -0.05, -0.18, -0.28, -0.46, -0.57, -0.67, -0.8, -0.77, -0.88, -0.92, -1.01, -0.85, -0.87, -1.12, -0.92, -1.02, -0.91 -84.69 -2285.84 74.86 -2126.29 83.35 1183.92 3 3 #4585AAFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanCyv 1.53, -3.84, 3.43, 1.16, 4.07, 0.48, 2.27, 2.74, 2.87, 2.02, 1.36, 2.1, 2.14, 1.91, 2.01, 2.08, 2.8, 2.4, 2.4, 2.85, 7.15, 15.39, 18.36, 21.59, 23.55, 24.16, 25.85, 27.27, 28.13, 27.43, 29.46, 29.93, 29.75, 28.61, 32.84, 31.49, 30.24, 30.8, 31.68 0.43, -1.24, 1.39, 0.49, 1.43, 0.36, 0.9, 1.03, 1.05, 0.85, 0.64, 0.87, 0.87, 0.81, 0.84, 0.86, 1.04, 0.95, 0.92, 1.11, 1.82, 2.43, 2.56, 2.72, 2.79, 2.82, 2.88, 2.94, 2.96, 2.94, 3.01, 3.02, 3.02, 2.98, 3.11, 3.07, 3.03, 3.05, 3.08 -90.01 -1035.90 69.54 -876.34 86.01 558.95 3 3 #AF731CFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanDes 3.59, -0.96, -0.56, 0.58, 3.37, 3.39, 5.07, 4.09, 3.02, 2.63, 1.59, 1.71, 1.19, 1.25, 1.43, 0.96, 1.99, 1.6, 1.65, 2.17, 21.35, 31.52, 39.86, 45.24, 47.58, 42.98, 34.89, 25.61, 18.66, 13.52, 10.94, 9.34, 8.09, 7.46, 6.89, 6.46, 6.98, 6.17, 6.5 1.28, -0.32, -0.17, 0.16, 0.7, 0.65, 0.9, 0.76, 0.62, 0.55, 0.37, 0.39, 0.29, 0.3, 0.33, 0.25, 0.42, 0.42, 0.26, 0.78, 2.08, 2.25, 2.52, 2.6, 2.66, 2.57, 2.38, 2.11, 1.84, 1.57, 1.4, 1.28, 1.18, 1.13, 1.07, 1.03, 1.08, 1, 1.03 -245.37 -1286.62 -85.81 -1127.06 163.69 684.31 3 3 #979F19FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanChr 1.68, -0.56, 2.15, -1.54, 0.45, -0.76, 0.71, 1.05, 1.04, 1.77, 1.93, 2.12, 2.36, 2.51, 2.62, 2.65, 2.89, 3.13, 2.98, 3.2, 3.54, 3.88, 3.99, 4.51, 4.71, 5.4, 5.72, 6.59, 6.96, 6.96, 6.61, 6.41, 6.57, 6.05, 5.79, 4.91, 4.23, 3.72, 4.76 0.52, -0.34, 1.15, -0.96, 0.27, -0.48, 0.41, 0.46, 0.49, 0.72, 0.76, 0.82, 0.88, 0.91, 0.94, 0.95, 1, 1.05, 1.02, 1.07, 1.14, 1.2, 1.22, 1.3, 1.34, 1.44, 1.49, 1.6, 1.64, 1.64, 1.6, 1.57, 1.59, 1.53, 1.49, 1.37, 1.26, 1.17, 1.35 -422.12 -1113.46 -262.56 -953.90 252.06 597.73 3 3 #5C4336FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanXac 3.32, 0.72, 0.13, 1.63, 0.74, 1.61, 1.31, 1.27, 1.27, 1.21, 1.13, 1.35, 1.11, 1.25, 1.37, 1.29, 1.57, 1.72, 1.38, 1.96, 2.24, 3.48, 6.37, 11.38, 19.71, 27.26, 33.84, 39.02, 44.39, 44.89, 49, 50.18, 52.09, 53.12, 53.92, 54.04, 55.17, 54.94, 54.53 1.2, 0.2, 0.05, 0.41, 0.2, 0.4, 0.33, 0.32, 0.32, 0.31, 0.29, 0.34, 0.29, 0.32, 0.35, 0.33, 0.39, 0.42, 0.35, 0.47, 0.52, 0.73, 1.09, 1.53, 1.96, 2.23, 2.42, 2.55, 2.67, 2.68, 2.76, 2.78, 2.82, 2.83, 2.85, 2.85, 2.87, 2.87, 2.86 -467.33 -1836.03 -307.77 -1676.47 274.66 959.02 3 3 #DA6725FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanSch 1.86, 0.03, 0.78, 0.5, 1.61, 1.01, 1.41, 1.2, 1.93, 1.49, 1.53, 1.63, 1.43, 1.64, 1.9, 1.64, 2.51, 2.62, 2.79, 2.34, 12.44, 24.74, 29.89, 35.07, 39.5, 41.01, 42.43, 42.4, 42.48, 41.8, 42.43, 42.5, 44.15, 44.5, 45.97, 46.02, 48.08, 47.46, 47.75 0.62, -0.01, 0.36, 0.23, 0.63, 0.42, 0.56, 0.5, 0.72, 0.59, 0.6, 0.63, 0.57, 0.63, 0.7, 0.64, 0.84, 0.91, 0.83, 1.02, 2.17, 2.66, 2.84, 2.99, 3.1, 3.14, 3.17, 3.17, 3.17, 3.15, 3.17, 3.17, 3.21, 3.21, 3.25, 3.25, 3.29, 3.28, 3.28 -407.65 -1297.92 -248.09 -1138.37 244.83 689.96 3 3 #D38F00FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanJoh 5.24, 2.1, -1.52, 1.17, 0.88, 1.69, 2.76, 3.29, 2.15, 2.3, 0.83, 1.17, 0.56, 0.95, 1.06, 1.12, 1.84, 1.99, 2.32, 1.85, 13.07, 26.61, 31.29, 35.85, 37.19, 35.5, 31.97, 26.86, 22.47, 18.21, 15.3, 14.15, 12.08, 11.65, 10.64, 9.63, 10.22, 9.13, 9.92 1.66, 0.38, -0.32, 0.23, 0.13, 0.29, 0.42, 0.49, 0.34, 0.37, 0.15, 0.2, 0.1, 0.17, 0.18, 0.2, 0.29, 0.34, 0.32, 0.42, 1.34, 1.82, 1.94, 2.06, 2.09, 2.05, 1.96, 1.82, 1.67, 1.5, 1.37, 1.31, 1.2, 1.17, 1.11, 1.04, 1.08, 1.01, 1.06 -93.18 -1440.59 66.38 -1281.03 87.59 761.30 3 3 #A3952FFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanArt 1.47, 0.36, -0.3, -0.84, 0.77, 0.53, 0.49, 0.84, -0.15, 0.58, -0.06, 0.52, -0.05, 0.33, 0.2, 0.27, 0.42, 0.47, 0.23, 0.73, 1.82, 7.97, 12.1, 16.36, 19.86, 22.3, 24.21, 26.87, 28.7, 30.14, 32.19, 33.28, 34.66, 36, 36.16, 37.47, 37.49, 37.51, 37.38 0.38, 0.18, -0.19, -0.44, 0.42, 0.24, 0.31, 0.46, -0.06, 0.34, -0.02, 0.32, -0.02, 0.2, 0.13, 0.17, 0.25, 0.27, 0.17, 0.38, 0.97, 1.95, 2.21, 2.52, 2.67, 2.79, 2.86, 2.96, 3.02, 3.07, 3.13, 3.16, 3.2, 3.24, 3.24, 3.28, 3.28, 3.28, 3.28 -445.05 -1027.25 -285.50 -867.69 263.53 554.62 3 3 #B66400FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanIct 1.66, 0.35, 1.12, 0.13, 1.68, 1.93, 1.75, 2.39, 2.1, 1.87, 1.73, 1.78, 1.21, 1.38, 1.49, 1.34, 1.73, 2.02, 1.69, 2.09, 7.6, 20.56, 25.75, 29.67, 32.84, 33.63, 33.9, 32.99, 33.26, 31.79, 32.36, 31.86, 32.43, 32.22, 32.35, 32.46, 32.78, 32.53, 32.88 0.51, 0.21, 0.52, 0.05, 0.77, 0.73, 0.73, 0.89, 0.81, 0.76, 0.71, 0.73, 0.55, 0.6, 0.64, 0.59, 0.71, 0.81, 0.67, 0.9, 1.87, 2.64, 2.79, 2.95, 3.03, 3.06, 3.06, 3.04, 3.05, 3, 3.02, 3, 3.02, 3.01, 3.02, 3.02, 3.03, 3.02, 3.03 -396.16 -1244.93 -236.61 -1085.37 239.08 663.46 3 3 #BC8300FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanFlo 2.36, -0.2, 1.49, 2.68, 2.19, 2.82, 2.22, 2.09, 1.11, 0.98, 0.74, 0.76, 0.2, 0.25, 0.32, 0.03, 0.76, 0.44, 1.08, -1.06, 16.59, 41.63, 50.6, 59.87, 63.98, 65.84, 65.42, 63.9, 61.57, 57.98, 56.59, 54.21, 54.35, 52.11, 53.12, 51.09, 53.09, 50.97, 51.7 0.86, -0.05, 0.47, 0.78, 0.64, 0.79, 0.65, 0.64, 0.39, 0.35, 0.27, 0.28, 0.08, 0.11, 0.12, 0.05, 0.22, 0.31, 0.05, 0.47, 2.37, 2.91, 3.12, 3.27, 3.34, 3.36, 3.36, 3.33, 3.3, 3.24, 3.22, 3.17, 3.18, 3.14, 3.16, 3.12, 3.15, 3.12, 3.13 -230.86 -1278.26 -71.30 -1118.70 156.43 680.13 3 3 #F6B000FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanPar 4.76, 0.69, -0.71, 1.12, -0.61, 0.8, -0.16, -0.02, -0.46, -0.16, -0.33, 0.05, -0.68, 0.07, 0.28, 0.78, 1.83, 3.55, 4.57, 6.02, 12.1, 21.94, 27.74, 32.57, 37.25, 40.1, 43.03, 44.83, 46.75, 46.98, 48.14, 47.3, 48.76, 47.66, 47.9, 46.06, 47.46, 45.34, 46.03 1.56, 0.14, -0.16, 0.23, -0.13, 0.16, -0.03, 0, -0.1, -0.03, -0.07, 0.01, -0.15, 0.02, 0.06, 0.16, 0.33, 0.57, 0.67, 0.84, 1.31, 1.74, 1.92, 2.06, 2.18, 2.24, 2.31, 2.34, 2.38, 2.39, 2.41, 2.39, 2.42, 2.4, 2.4, 2.37, 2.39, 2.35, 2.37 -401.07 -1763.14 -241.51 -1603.58 241.53 922.57 3 3 #DF9321FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanLav 2.29, -0.04, -0.86, -0.78, 0.27, -1.02, -0.92, -1.01, -0.57, -0.71, -0.88, -0.6, -0.73, -0.62, -0.4, -0.5, -0.27, -0.15, -0.42, 0.09, 0.15, 0.68, 1.12, 1.93, 3.15, 4.14, 5.69, 7.54, 9.2, 11.3, 13.4, 16.12, 18.57, 21.14, 23.83, 26.89, 28.29, 30.94, 30.79 0.83, -0.03, -0.42, -0.42, 0.17, -0.56, -0.52, -0.6, -0.27, -0.38, -0.49, -0.3, -0.39, -0.31, -0.19, -0.24, -0.13, -0.07, -0.2, 0.04, 0.07, 0.27, 0.4, 0.63, 0.87, 1.04, 1.26, 1.46, 1.62, 1.78, 1.93, 2.09, 2.21, 2.33, 2.44, 2.55, 2.59, 2.68, 2.67 -393.92 -895.76 -234.36 -736.21 237.96 488.88 3 3 #7B351CFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanGyr 3.38, 1.7, 0.25, -0.04, 0.79, -0.17, 0.89, -0.13, 0.87, -0.24, 0.56, 0.28, 0.37, 0.39, 0.48, 0.47, 0.67, 0.79, 0.69, 1.04, 1.13, 1.64, 1.8, 2.39, 3.29, 4.24, 5.29, 6.62, 8.29, 9.71, 11.98, 14.21, 15.74, 18.95, 20.32, 22.3, 24.2, 23.63, 24.26 1.22, 0.43, 0.09, -0.06, 0.23, -0.05, 0.24, -0.03, 0.24, -0.06, 0.15, 0.08, 0.11, 0.11, 0.13, 0.13, 0.18, 0.21, 0.19, 0.27, 0.29, 0.4, 0.43, 0.54, 0.68, 0.82, 0.94, 1.09, 1.24, 1.36, 1.52, 1.65, 1.74, 1.89, 1.95, 2.03, 2.1, 2.08, 2.1 -342.31 -1377.18 -182.76 -1217.62 212.16 729.59 3 3 #784031FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanVas 2.09, 1.13, 0.26, -1.14, 0.8, 1.36, 2.37, 2.2, 2.82, 3.35, 4.91, 7.21, 10.99, 14.77, 18.51, 22.2, 25.58, 27.9, 28.14, 27.89, 26.31, 24.28, 22.82, 21.4, 21.36, 20.29, 19.91, 20.01, 19.49, 19.41, 19.64, 18.95, 19.31, 19.43, 19.82, 19.31, 19.61, 19.93, 20.63 0.74, 0.39, 0.14, -0.64, 0.45, 0.43, 0.8, 0.7, 0.86, 0.96, 1.22, 1.51, 1.85, 2.09, 2.29, 2.46, 2.58, 2.66, 2.67, 2.66, 2.61, 2.54, 2.48, 2.42, 2.42, 2.37, 2.35, 2.36, 2.33, 2.33, 2.34, 2.31, 2.33, 2.33, 2.35, 2.33, 2.34, 2.35, 2.39 -343.94 -1095.18 -184.38 -935.63 212.97 588.59 3 3 #84887CFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanNiv 8.46, 0.55, -0.78, -0.53, -1.86, -1.07, -1.66, -0.9, -0.49, 1.33, 3.43, 7.17, 10.04, 14.09, 17.8, 22.46, 27.91, 34.82, 41.08, 48.99, 58.5, 67.08, 75.64, 81.06, 84.7, 82.33, 77.57, 68.11, 59.55, 50.33, 42.89, 36.32, 31.91, 27.93, 24.91, 22.08, 20.66, 19.37, 19.38 2.14, 0.06, -0.09, -0.07, -0.24, -0.14, -0.22, -0.11, -0.06, 0.15, 0.35, 0.62, 0.79, 0.99, 1.14, 1.3, 1.46, 1.64, 1.77, 1.92, 2.07, 2.19, 2.3, 2.36, 2.4, 2.37, 2.32, 2.21, 2.09, 1.94, 1.81, 1.67, 1.56, 1.46, 1.37, 1.28, 1.24, 1.19, 1.19 -368.45 -2068.69 -208.89 -1909.13 225.23 1075.35 3 3 #E5E382FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanFuc 4.2, 1.48, 0.4, 0.92, 0.78, 0.88, 0.42, 1.17, 1.64, 1.73, 2.8, 3.92, 4.8, 6.51, 7.85, 9.96, 12.17, 15.46, 17.67, 22.3, 25.99, 30.17, 32.8, 34.41, 34.98, 32.61, 29.73, 26.65, 23.09, 20.87, 18.92, 16.91, 16.61, 14.3, 15.6, 13.26, 14.45, 13.56, 13.56 1.43, 0.33, 0.08, 0.2, 0.17, 0.19, 0.1, 0.25, 0.33, 0.35, 0.52, 0.66, 0.77, 0.94, 1.06, 1.22, 1.37, 1.55, 1.66, 1.85, 1.98, 2.11, 2.18, 2.22, 2.24, 2.17, 2.09, 2, 1.87, 1.79, 1.71, 1.62, 1.6, 1.49, 1.55, 1.43, 1.49, 1.44, 1.44 -410.59 -1702.53 -251.03 -1542.98 246.30 892.27 3 3 #9A9C5BFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanDow 8.09, 1.73, 1.65, 0.53, -3.36, -1.49, -1.66, -4.1, -3.06, -3.84, -2.12, -3.23, -3.22, -2.43, -2.19, -1.8, -1.04, -0.35, -0.12, 1.63, 2.78, 3.69, 4.83, 5.97, 7.02, 6.73, 7.31, 7.86, 8.09, 7.57, 8.4, 8.71, 9.61, 9.17, 9.98, 10.69, 12.6, 12.6, 11.92 2.09, 0.17, 0.18, 0.08, -0.49, -0.22, -0.2, -0.7, -0.48, -0.63, -0.29, -0.51, -0.51, -0.35, -0.32, -0.25, -0.14, -0.04, -0.01, 0.19, 0.3, 0.38, 0.47, 0.55, 0.62, 0.61, 0.64, 0.68, 0.69, 0.66, 0.71, 0.73, 0.78, 0.76, 0.8, 0.84, 0.94, 0.94, 0.91 129.56 -1400.95 289.12 -1241.39 -23.78 741.48 3 3 #80623FFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanRuu 6.86, 0.79, -4.5, -3.67, 1.45, -3.05, -2.2, -2.79, -1.46, -1.28, -2, -1.03, -0.97, -0.7, -0.67, -0.41, -0.16, -0.06, 0.02, 0.99, 0.74, 1.03, 1.1, 1.33, 1.96, 2.19, 3.01, 3.23, 3.38, 3.79, 3.77, 4.04, 4.57, 4.05, 4.26, 5.29, 6.36, 7.6, 6.76 1.9, 0.29, -0.94, -0.72, 0.36, -0.55, -0.36, -0.48, -0.21, -0.18, -0.31, -0.14, -0.12, -0.08, -0.07, -0.04, 0, 0.02, 0.03, 0.16, 0.13, 0.17, 0.18, 0.21, 0.28, 0.31, 0.39, 0.41, 0.43, 0.47, 0.46, 0.49, 0.54, 0.49, 0.51, 0.6, 0.69, 0.77, 0.71 11.83 -1060.96 171.39 -901.40 35.08 571.48 3 3 #674F43FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanPun 6.01, 1.59, -1.13, -0.28, 0.25, 0.72, 0.5, 0.87, 2.41, 3.03, 5.61, 7.78, 8.77, 9.58, 9.81, 10.2, 11.43, 12.98, 13.34, 16.7, 19.34, 22.03, 25.11, 27.67, 32, 33.91, 34.69, 33.01, 31.02, 26.31, 23.38, 19.94, 17.82, 15.29, 13.65, 13.43, 11.64, 11.59, 11.81 1.79, 0.24, -0.17, -0.07, 0.05, 0.1, 0.08, 0.14, 0.34, 0.41, 0.67, 0.83, 0.9, 0.95, 0.97, 0.99, 1.07, 1.15, 1.17, 1.33, 1.44, 1.54, 1.65, 1.73, 1.85, 1.89, 1.91, 1.87, 1.82, 1.68, 1.59, 1.47, 1.38, 1.27, 1.18, 1.17, 1.08, 1.07, 1.09 -263.23 -1665.05 -103.67 -1505.50 172.62 873.53 3 3 #B19665FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanXag 5.2, 2.48, 3.61, 5.9, 8.38, 11.22, 12.94, 13.67, 8.66, 5.57, 0.58, 0.07, -1.21, -1.21, -1.07, -1.44, -0.56, -0.41, -1.26, 0.94, 21.15, 30.34, 35.76, 39.44, 41.43, 39.14, 35.24, 29.49, 23.87, 18.86, 15.25, 12.45, 10.48, 8.69, 7.35, 6.87, 5.36, 6.27, 5.58 1.65, 0.43, 0.51, 0.78, 0.96, 1.16, 1.24, 1.31, 0.98, 0.78, 0.14, 0.01, -0.25, -0.27, -0.23, -0.31, -0.13, -0.04, -0.37, 0.5, 1.75, 1.89, 2.08, 2.14, 2.2, 2.14, 2.05, 1.9, 1.73, 1.54, 1.37, 1.23, 1.11, 0.99, 0.88, 0.84, 0.71, 0.79, 0.73 -336.35 -2013.80 -176.79 -1854.25 209.17 1047.90 3 3 #A59C08FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanGut 4.83, -2.47, 0.91, 0.66, 1.78, 1.96, 3.88, 4.35, 3.21, 3.51, 1.65, 1.68, 1.44, 1.49, 2.02, 1.7, 2.51, 2.76, 2.38, 3.29, 14.84, 19.74, 22.4, 24.57, 26.03, 25.46, 23.67, 21.54, 19.2, 16.43, 14.58, 12.69, 12.72, 10.24, 10.91, 10.3, 8.67, 9.11, 9.85 1.57, -0.6, 0.25, 0.08, 0.33, 0.34, 0.6, 0.64, 0.51, 0.55, 0.3, 0.3, 0.26, 0.27, 0.35, 0.31, 0.41, 0.47, 0.36, 0.62, 1.47, 1.61, 1.74, 1.8, 1.86, 1.84, 1.78, 1.7, 1.61, 1.48, 1.39, 1.29, 1.29, 1.14, 1.18, 1.14, 1.03, 1.06, 1.11 -104.05 -1471.73 55.50 -1312.17 93.03 776.86 3 3 #968439FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanVar 3.8, 0.62, 0.93, 0.85, 2.96, 5.04, 6.54, 7.32, 5.85, 4.48, 2.19, 1.46, 0.91, 0.81, 1.07, 0.59, 1.45, 1.77, 1.23, 2.6, 14.08, 20.33, 23.62, 26.36, 27.95, 25.86, 23.35, 19.47, 15.41, 12.73, 10.25, 7.97, 7.19, 6.25, 6.43, 4.96, 5.29, 5.1, 5.68 1.33, 0.12, 0.24, 0.18, 0.62, 0.83, 1.01, 1.07, 0.93, 0.79, 0.47, 0.32, 0.22, 0.19, 0.25, 0.15, 0.32, 0.4, 0.23, 0.67, 1.63, 1.83, 1.99, 2.07, 2.13, 2.06, 1.97, 1.82, 1.63, 1.47, 1.31, 1.13, 1.06, 0.97, 0.99, 0.84, 0.87, 0.85, 0.91 -353.71 -1639.35 -194.15 -1479.79 217.85 860.67 3 3 #898329FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanPal 11.34, 1.88, 6.08, 9.68, 9.39, 12.13, 12.14, 13.51, 12.86, 12.52, 11.95, 11.89, 10.95, 10.78, 10.37, 9.99, 9.9, 9.64, 9.11, 9.38, 8.95, 8.83, 8.55, 8.61, 8.62, 8.62, 8.38, 8.62, 8.43, 8.55, 8.21, 8.19, 8.2, 8.59, 7.92, 8.72, 9.23, 7.75, 8.69 2.43, 0.17, 0.43, 0.62, 0.6, 0.73, 0.73, 0.79, 0.76, 0.74, 0.72, 0.72, 0.68, 0.67, 0.65, 0.63, 0.63, 0.62, 0.59, 0.6, 0.58, 0.58, 0.56, 0.57, 0.57, 0.57, 0.55, 0.57, 0.56, 0.56, 0.54, 0.54, 0.54, 0.56, 0.53, 0.57, 0.6, 0.52, 0.57 -131.43 -2219.63 28.13 -2060.07 106.72 1150.81 3 3 #85797BFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanVit 0, 0.01, 4.2, 2.7, 3.34, 3.91, 1.35, 1.67, 3.57, 3.15, 3.4, 3.74, 3.87, 4.26, 4.14, 4.35, 4.68, 5.59, 5.79, 7.34, 8.34, 9.75, 11.41, 13.76, 17.3, 20.22, 24.01, 27.2, 30.16, 33.64, 35.49, 38.05, 40.53, 40.83, 40.18, 41.18, 41.45, 40.94, 40.48 0, -0.33, 1.63, 0.94, 1.11, 1.46, 0.39, 0.51, 1.34, 1.12, 1.24, 1.31, 1.36, 1.45, 1.42, 1.47, 1.55, 1.72, 1.76, 2, 2.12, 2.28, 2.44, 2.63, 2.86, 3.01, 3.18, 3.31, 3.41, 3.52, 3.57, 3.64, 3.7, 3.71, 3.69, 3.72, 3.72, 3.71, 3.7 -131.45 -862.66 28.11 -703.10 106.72 472.33 3 3 #B5612BFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanCuc 5.34, 0.23, 0.65, -0.33, 0.09, 0.25, 0.33, -0.08, 0.29, 0.01, 0.29, 0.18, 0.27, 0.17, 0.32, 0.26, 0.46, 0.47, 0.4, 0.65, 0.84, 0.73, 0.98, 1.05, 1.72, 1.6, 1.84, 2.25, 2.24, 2.73, 3.52, 3.21, 4.26, 4.25, 4.88, 5.2, 6.71, 5.3, 6.61 1.68, 0.04, 0.12, -0.07, 0.02, 0.04, 0.06, -0.01, 0.05, 0, 0.05, 0.03, 0.05, 0.03, 0.06, 0.05, 0.08, 0.09, 0.07, 0.12, 0.15, 0.13, 0.17, 0.18, 0.28, 0.26, 0.3, 0.35, 0.35, 0.41, 0.51, 0.47, 0.59, 0.59, 0.65, 0.68, 0.81, 0.69, 0.81 -387.85 -1674.71 -228.29 -1515.15 234.92 878.35 3 3 #5B463FFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanCay 2.77, 1.5, 0.25, 0.79, 0.47, -0.04, 0.58, 0.21, 0.46, 0.67, 0.58, 0.61, 0.72, 1.23, 1.47, 1.87, 2.46, 3.23, 3.6, 5.08, 6.41, 7.69, 9.38, 11.34, 13.96, 16.33, 18.39, 20.81, 22.67, 24.11, 25.86, 26.44, 27.74, 28.84, 28.74, 30.08, 29.39, 30.74, 30.08 1.02, 0.47, 0.07, 0.24, 0.15, -0.01, 0.19, 0.07, 0.16, 0.21, 0.19, 0.2, 0.23, 0.37, 0.42, 0.52, 0.64, 0.78, 0.83, 1.05, 1.2, 1.33, 1.48, 1.63, 1.8, 1.93, 2.04, 2.14, 2.22, 2.27, 2.34, 2.36, 2.4, 2.44, 2.43, 2.47, 2.45, 2.49, 2.47 -346.31 -1334.03 -186.76 -1174.48 214.16 708.02 3 3 #A4622FFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanPre 9.94, 0.67, -0.51, -0.3, -3.96, -4.09, -4.01, -3.86, -4.94, -5.52, -5.15, -4.84, -5.49, -5.29, -5.12, -4.78, -4.45, -3.92, -3.68, -1.88, -0.63, 1.27, 3.92, 7.66, 12.89, 16.74, 22.74, 27.35, 29.64, 31.59, 33.02, 32.04, 31.57, 30.82, 31.2, 29.08, 27.21, 28.29, 27.94 2.3, 0.07, -0.06, -0.02, -0.48, -0.54, -0.51, -0.49, -0.69, -0.81, -0.73, -0.67, -0.8, -0.76, -0.72, -0.65, -0.59, -0.5, -0.46, -0.2, -0.06, 0.13, 0.34, 0.59, 0.84, 0.99, 1.2, 1.32, 1.38, 1.43, 1.46, 1.44, 1.43, 1.41, 1.42, 1.37, 1.32, 1.35, 1.34 -258.39 -1823.79 -98.83 -1664.23 170.20 952.89 3 3 #C76E2CFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanNic 21.84, 2.24, 9.05, 20.54, 23.59, 28.47, 31.61, 36.13, 38.81, 41.89, 43.91, 45.59, 46.02, 46.24, 45.65, 44.63, 43.35, 41.45, 40.08, 37.05, 35.59, 32.44, 30.83, 27.38, 26.73, 24.4, 23.14, 21.26, 20.51, 18.44, 18.22, 16.65, 17.06, 15.73, 15.41, 14.38, 14, 13.97, 12.97 3.08, 0.1, 0.37, 0.67, 0.73, 0.84, 0.9, 0.98, 1.02, 1.07, 1.1, 1.13, 1.13, 1.14, 1.13, 1.11, 1.09, 1.06, 1.04, 0.99, 0.97, 0.91, 0.88, 0.81, 0.8, 0.75, 0.72, 0.68, 0.66, 0.61, 0.61, 0.57, 0.58, 0.54, 0.53, 0.51, 0.5, 0.49, 0.47 -347.43 -3003.07 -187.87 -2843.51 214.71 1542.53 3 3 #B0BBCFFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanCya 12.85, 0.83, 8, 12.52, 19.92, 27.28, 35.59, 41.06, 41.7, 37.42, 32.81, 28.97, 26.91, 25.33, 25.11, 25.44, 26.73, 28.46, 31.83, 34.31, 39.79, 44.79, 50.97, 54.78, 55.66, 53.25, 46.13, 36.09, 26.77, 18.53, 12.36, 7.48, 4.36, 1.9, 0.29, -0.83, -1.49, -3.01, -2.02 2.55, 0.09, 0.51, 0.68, 0.95, 1.14, 1.33, 1.44, 1.45, 1.37, 1.27, 1.18, 1.13, 1.09, 1.08, 1.09, 1.13, 1.17, 1.25, 1.3, 1.41, 1.5, 1.61, 1.66, 1.67, 1.64, 1.53, 1.35, 1.14, 0.9, 0.68, 0.47, 0.3, 0.14, 0.02, -0.06, -0.12, -0.26, -0.17 -321.06 -2469.20 -161.50 -2309.65 201.53 1275.60 3 3 #ACC89EFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanLar 7.5, -0.72, 0.2, -1.03, -0.35, 0.54, -0.04, 0.82, 0.54, 0.25, 0.58, 0.85, 2.29, 5.15, 8.34, 12.07, 14.63, 17, 18.04, 19.71, 21.22, 23.28, 25.65, 28.2, 32.41, 36.34, 40.52, 45.67, 52.37, 58.14, 65.36, 72.63, 77.5, 81.27, 80.9, 78.63, 73.18, 68.76, 67.52 2.02, -0.1, 0.03, -0.16, -0.04, 0.06, 0, 0.1, 0.07, 0.03, 0.08, 0.11, 0.28, 0.53, 0.76, 0.96, 1.08, 1.18, 1.23, 1.29, 1.34, 1.41, 1.49, 1.56, 1.67, 1.77, 1.86, 1.96, 2.08, 2.17, 2.28, 2.37, 2.43, 2.47, 2.47, 2.44, 2.38, 2.32, 2.3 -255.51 -1951.56 -95.95 -1792.00 168.75 1016.78 3 3 #F29A66FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanCyp 4.89, 0.88, -0.29, -0.08, -0.29, 0, -0.85, -0.5, 0.01, -0.27, -0.21, 0.08, -0.21, 0.05, -0.02, 0.22, 0.14, 0.33, 0.14, 0.52, 0.38, 0.51, 0.56, 0.52, 0.99, 0.83, 0.77, 1.16, 0.86, 0.96, 1.3, 0.97, 1.86, 1.56, 1.7, 1.28, 2.86, 1.23, 2.61 1.59, 0.17, -0.06, -0.03, -0.06, 0, -0.19, -0.11, 0, -0.06, -0.04, 0.02, -0.04, 0.01, 0, 0.05, 0.03, 0.07, 0.03, 0.1, 0.07, 0.1, 0.11, 0.1, 0.18, 0.16, 0.15, 0.21, 0.16, 0.18, 0.24, 0.18, 0.32, 0.28, 0.3, 0.24, 0.46, 0.23, 0.43 -357.86 -1544.53 -198.30 -1384.97 219.93 813.26 3 3 #4D413CFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanVir 5.85, 1.09, 0.37, 0.38, -0.04, -0.44, -0.74, -0.6, -0.62, -0.61, -0.68, -0.48, -0.71, -0.47, -0.58, -0.4, -0.44, -0.13, -0.63, -0.1, -0.17, -0.18, -0.22, -0.27, 0.39, 0.13, 0.05, 0.44, 0.13, 0.26, 0.52, 0.34, 0.7, 0.63, 0.91, 0.88, 1.75, 0.92, 1.38 1.77, 0.17, 0.06, 0.07, -0.01, -0.07, -0.14, -0.11, -0.11, -0.11, -0.12, -0.09, -0.13, -0.08, -0.1, -0.07, -0.08, -0.02, -0.11, -0.02, -0.03, -0.03, -0.04, -0.05, 0.07, 0.02, 0.01, 0.07, 0.02, 0.04, 0.09, 0.06, 0.11, 0.1, 0.14, 0.14, 0.26, 0.15, 0.21 -457.94 -1756.71 -298.39 -1597.15 269.97 919.35 3 3 #4E423EFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanHei 4.75, -3.07, -2.02, 1.32, -0.86, 0.18, 0.23, -0.75, -0.62, -0.37, -0.07, 0.11, -0.36, 0.08, 0.19, 0.34, 0.37, 0.67, 0.21, 0.97, 0.66, 1.17, 0.84, 0.56, 1.25, 1.51, 1.04, 1.13, 1.57, 1.85, 1.01, 0.74, 2.4, 1.92, 0.88, 1.21, 3.26, 1.85, 1.87 1.56, -1.01, -0.42, 0.25, -0.18, 0.03, 0.05, -0.17, -0.14, -0.08, -0.02, 0.02, -0.08, 0.02, 0.04, 0.07, 0.07, 0.13, 0.05, 0.19, 0.13, 0.22, 0.16, 0.11, 0.23, 0.28, 0.2, 0.21, 0.28, 0.33, 0.19, 0.15, 0.41, 0.34, 0.17, 0.24, 0.53, 0.33, 0.33 -112.34 -1032.48 47.21 -872.92 97.17 557.24 3 3 #4E423CFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanArg 2.43, 1.21, -0.46, -0.39, 0.98, 0, 0.19, 0.74, -0.35, 0.59, -0.02, 0.52, 0.2, 0.42, 0.38, 0.5, 0.44, 0.48, 0.42, 0.7, 0.57, 0.7, 0.55, 0.84, 0.63, 0.97, 0.61, 1.24, 0.63, 1.21, 0.86, 1, 0.78, 0.9, 1.04, 1.08, 1.05, 0.82, 0.81 0.89, 0.46, -0.24, -0.16, 0.38, -0.05, 0.09, 0.27, -0.13, 0.23, 0, 0.2, 0.08, 0.16, 0.14, 0.19, 0.17, 0.18, 0.16, 0.26, 0.21, 0.25, 0.2, 0.3, 0.23, 0.34, 0.23, 0.42, 0.23, 0.41, 0.3, 0.35, 0.28, 0.31, 0.35, 0.37, 0.36, 0.28, 0.29 -414.90 -1145.15 -255.34 -985.59 248.45 613.57 3 3 #39302CFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
ThrCyp 11.77, -0.67, 0.13, 2.8, 1.8, -0.03, 3.33, 5.12, 5.42, 3.35, 2.27, 3.02, 0.91, 0.86, 0.47, 0.74, 2.37, 2.71, 2.32, 5.61, 7.58, 8.42, 9.53, 10.28, 11.6, 9.39, 8.24, 6.98, 5.35, 3.61, 3.07, 1.81, 2.33, 1.34, 0.53, 1.46, 2.8, 1.13, 0.57 2.47, -0.06, 0.02, 0.21, 0.14, 0, 0.26, 0.36, 0.38, 0.25, 0.17, 0.23, 0.08, 0.07, 0.04, 0.06, 0.19, 0.21, 0.18, 0.4, 0.5, 0.54, 0.59, 0.63, 0.69, 0.59, 0.53, 0.47, 0.38, 0.27, 0.23, 0.14, 0.18, 0.11, 0.04, 0.12, 0.22, 0.09, 0.05 -65.92 -1943.21 93.63 -1783.65 73.96 1012.60 3 3 #7B7A5EFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
ThrAbb 16.54, 1.66, 3.83, 7.07, 13.06, 16.5, 20.89, 26.89, 31.29, 34.34, 32.38, 28.48, 22.39, 17.1, 12.63, 8.85, 6.82, 4.7, 2.7, 2.28, 1.24, 0.49, -0.25, -0.59, -0.62, -1.28, -1.32, -1.73, -1.54, -2.11, -1.65, -1.89, -2.35, -2.07, -2.22, -1.92, -1.93, -2.61, -1.96 2.81, 0.1, 0.21, 0.37, 0.58, 0.7, 0.82, 0.97, 1.06, 1.12, 1.08, 1, 0.86, 0.71, 0.57, 0.43, 0.35, 0.25, 0.15, 0.13, 0.07, 0.03, -0.01, -0.04, -0.04, -0.08, -0.08, -0.11, -0.1, -0.14, -0.11, -0.12, -0.15, -0.13, -0.14, -0.12, -0.12, -0.17, -0.13 -397.18 -2562.20 -237.62 -2402.64 239.59 1322.10 3 3 #716D8EFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
ThrPal 11.45, 2.59, 6.51, 12.53, 15.59, 21.28, 24.9, 29.54, 29.15, 28.85, 21.81, 14.59, 9.79, 2.39, 4.58, -0.67, 0.33, 4.05, -0.75, 1.22, 8.47, 10.62, 10.22, 10.21, 10.12, 9.64, 9.17, 9.23, 9.02, 8.92, 8.62, 8.49, 8.19, 8.14, 8.45, 7.96, 7.93, 8.3, 7.91 2.44, 0.22, 0.47, 0.74, 0.86, 1.05, 1.16, 1.28, 1.26, 1.26, 1.07, 0.83, 0.64, 0.21, 0.34, -0.04, 0.02, 0.33, -0.07, 0.12, 0.57, 0.65, 0.64, 0.64, 0.63, 0.61, 0.59, 0.59, 0.58, 0.58, 0.56, 0.55, 0.54, 0.54, 0.55, 0.53, 0.53, 0.55, 0.53 -335.13 -2586.81 -175.57 -2427.25 208.56 1334.41 3 3 #8B7864FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
ThrOrn 26.62, 2.18, 3.78, 6.82, 8.85, 6.64, 8.4, 10.28, 11.85, 13.23, 12.79, 14.52, 11.16, 8.3, 6.09, 0.65, 1.14, -1.77, -5.4, -3.99, -4.92, -6.41, -7.72, -7.98, -8.18, -9.19, -9.89, -9.43, -9.88, -10.88, -10.88, -10.38, -9.84, -10.9, -11.48, -9.77, -9.86, -11.05, -11.11 3.28, 0.08, 0.13, 0.23, 0.29, 0.22, 0.28, 0.33, 0.37, 0.4, 0.39, 0.44, 0.35, 0.27, 0.21, 0.03, 0.04, -0.07, -0.22, -0.16, -0.2, -0.28, -0.34, -0.36, -0.37, -0.42, -0.46, -0.44, -0.46, -0.53, -0.53, -0.49, -0.46, -0.53, -0.56, -0.46, -0.46, -0.53, -0.54 -73.46 -2417.10 86.10 -2257.55 77.73 1249.55 3 3 #757693FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
ThrSay 7.72, 1.7, 1.9, 4, 5.85, 6.48, 7.58, 8.84, 10.4, 11.06, 11.06, 10.97, 9.95, 9.66, 9.11, 8.57, 9.36, 9.57, 9.6, 11.18, 12.52, 13.67, 14.77, 15.65, 16.97, 17.53, 17.35, 17.29, 16.44, 15.31, 14.35, 13.38, 12.77, 11.88, 11.29, 11.06, 11.03, 10.57, 10.38 2.04, 0.22, 0.22, 0.44, 0.57, 0.62, 0.69, 0.77, 0.86, 0.9, 0.9, 0.89, 0.84, 0.82, 0.79, 0.75, 0.8, 0.81, 0.82, 0.91, 0.97, 1.03, 1.08, 1.12, 1.17, 1.19, 1.19, 1.18, 1.15, 1.1, 1.06, 1.01, 0.98, 0.94, 0.91, 0.9, 0.89, 0.87, 0.86 -307.26 -2135.26 -147.70 -1975.70 194.63 1108.63 3 3 #937F6CFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
ThrEpi 15.7, 2.35, 2.66, 10.23, 11.87, 15.61, 19.17, 20.7, 21.43, 20.02, 18.61, 16.89, 16.17, 15.8, 16.35, 17.27, 18.17, 20.43, 21.56, 24.36, 26.63, 28.26, 28.91, 27.76, 26.68, 24.08, 21.37, 18.95, 17.02, 14.7, 14.15, 12.9, 12.51, 11.99, 11.93, 11.4, 11.46, 12.84, 11.7 2.75, 0.14, 0.17, 0.51, 0.56, 0.7, 0.8, 0.84, 0.86, 0.82, 0.78, 0.73, 0.71, 0.7, 0.71, 0.74, 0.77, 0.83, 0.86, 0.94, 0.99, 1.03, 1.04, 1.02, 0.99, 0.93, 0.86, 0.79, 0.74, 0.66, 0.64, 0.6, 0.59, 0.57, 0.57, 0.55, 0.55, 0.6, 0.56 -337.73 -2702.52 -178.17 -2542.97 209.87 1392.26 3 3 #A1AA94FF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
TanRuf 3.42, -1.91, 0.44, -1.22, 0.18, -0.64, 0.24, 0.09, -0.02, -0.06, 0.26, 0.39, 0.82, 1.19, 1.7, 2.39, 2.99, 3.79, 3.97, 5.23, 5.87, 6.57, 7.1, 7.92, 9.29, 10.07, 11, 11.8, 12.62, 13.25, 14.64, 14.65, 16.02, 16.15, 17.24, 17.3, 18, 18.7, 18.02 1.23, -0.64, 0.15, -0.4, 0.07, -0.2, 0.07, 0.03, -0.01, -0.02, 0.08, 0.11, 0.22, 0.3, 0.41, 0.53, 0.63, 0.74, 0.77, 0.93, 1, 1.07, 1.12, 1.2, 1.31, 1.37, 1.44, 1.49, 1.54, 1.58, 1.66, 1.66, 1.74, 1.74, 1.8, 1.8, 1.83, 1.87, 1.83 -514.83 -1489.36 -355.27 -1329.80 298.41 785.68 3 3 #835B3BFF 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 311.111, 322.222, 333.333, 344.444, 355.556, 366.667, 377.778, 388.889, 400, 411.111, 422.222, 433.333, 444.444, 455.556, 466.667, 477.778, 488.889, 500, 511.111, 522.222, 533.333, 544.444, 555.556, 566.667, 577.778, 588.889, 600, 611.111, 622.222, 633.333, 644.444, 655.556, 666.667, 677.778, 688.889 300, 700 300, 700
# Save the table as a CSV
write.csv(spline_table, "spline_summary_table.csv", row.names = FALSE)

# Fixing the PDF export by increasing the margins and adjusting the layout
pdf("spline_summary_table.pdf", width = 11, height = 8.5)
gridExtra::grid.table(spline_table, rows = NULL)
dev.off()
## png 
##   2

Step 7: Model scores table for reflectance and log reflectance splines

Here, we want to create a separate data frame in order to easily compare the model scores for the spline fits to each set of data (reflectance versus log-transformed reflectance values). This data frame will contain the AIC, BIC, and logLik scores that we obtained from our gls function and then we identify which model has the “better” score, and therefore which dataset we should use for our parameter estimation and ancestral state reconstruction.

# Creates a separate data frame only containing the species names and the model scores produced from our gls
spline_model_scores <- spline_table[,c(1,4:9)]

# Adds a column to the end of the data frame capturing the minimum AIC score between the two fits (lowest AIC score is the model you should select)
spline_model_scores <- spline_model_scores %>% 
  group_by(Species) %>%
  mutate(AIC_Preferred_Model_Score = min(c(Reflectance_AIC, Log_Reflectance_AIC)))

# Here we create a for loop system to identify and name which dataset used is preferred without having to manually check for each species.

# Placeholder vector to store which dataset is preferred to then be bound to the end of the model scoring data frame
preferred_model_name <- rep(NA, length(spline_model_scores$Species))

# for loop to determine which value (for each species) from our newly generated column matches to which dataset and store the output into the placeholder vector 
for (i in 1:length(spline_model_scores$Species)){
  if (spline_model_scores[i,8] == spline_model_scores[i,2]){
    preferred_model_name[i] <- "Reflectance"
  }
  else if (spline_model_scores[i,8] == spline_model_scores[i,3]){
    preferred_model_name[i] <- "Log Reflectance"
  }
  else if (spline_model_scores[i,8] == spline_model_scores[i,2] & spline_model_scores[i,3] == spline_model_scores[i,8]){
    preferred_model_name[i] <- "Either"
  }
    }

# Attaches the placeholder vector to the model scores data frame
spline_model_scores <- cbind(spline_model_scores, preferred_model_name)
## New names:
## • `` -> `...9`
# Takes the column names of the data frame and stores them in a vector
column_names <- colnames(spline_model_scores)

# Adds a new value to name our newly attached column
column_names[9] <- "AIC_Preferred_Model_Name"

# Applies our column names vector as the names for our data frame
colnames(spline_model_scores) <- column_names



# We recreate an identical process for BIC scores

spline_model_scores <- spline_model_scores %>% 
  group_by(Species) %>%
  mutate(BIC_Preferred_Model_Score = min(c(Reflectance_BIC, Log_Reflectance_BIC)))

preferred_model_name <- rep(NA, length(spline_model_scores$Species))
for (i in 1:length(spline_model_scores$Species)){
  if (spline_model_scores[i,10] == spline_model_scores[i,4]){
    preferred_model_name[i] <- "Reflectance"
  }
  else if (spline_model_scores[i,10] == spline_model_scores[i,5]){
    preferred_model_name[i] <- "Log Reflectance"
  }
  else if (spline_model_scores[i,10] == spline_model_scores[i,4] & spline_model_scores[i,5] == spline_model_scores[i,10]){
    preferred_model_name[i] <- "Either"
  }
    }

spline_model_scores <- cbind(spline_model_scores, preferred_model_name)
## New names:
## • `` -> `...11`
column_names <- colnames(spline_model_scores)
column_names[11] <- "BIC_Preferred_Model_Name"
colnames(spline_model_scores) <- column_names



# We create an almost identical process for logLik scores. The only change is that instead of looking for the minimum logLik score, we are looking for the maximum logLik score.

spline_model_scores <- spline_model_scores %>% 
  group_by(Species) %>%
  mutate(logLik_Preferred_Model_Score = max(c(Reflectance_logLik, Log_Reflectance_logLik)))

preferred_model_name <- rep(NA, length(spline_model_scores$Species))
for (i in 1:length(spline_model_scores$Species)){
  if (spline_model_scores[i,12] == spline_model_scores[i,6]){
    preferred_model_name[i] <- "Reflectance"
  }
  else if (spline_model_scores[i,12] == spline_model_scores[i,7]){
    preferred_model_name[i] <- "Log Reflectance"
  }
  else if (spline_model_scores[i,12] == spline_model_scores[i,6] & spline_model_scores[i,7] == spline_model_scores[i,12]){
    preferred_model_name[i] <- "Either"
  }
    }

spline_model_scores <- cbind(spline_model_scores, preferred_model_name)
## New names:
## • `` -> `...13`
column_names <- colnames(spline_model_scores)
column_names[13] <- "logLik_Preferred_Model_Name"
colnames(spline_model_scores) <- column_names

spline_model_scores$logLik_Preferred_Model_Name[spline_model_scores$logLik_Preferred_Model_Name == 0] <- "Reflectance"
spline_model_scores$logLik_Preferred_Model_Name[spline_model_scores$logLik_Preferred_Model_Name == 1] <- "Log Reflectance"
spline_model_scores$logLik_Preferred_Model_Name[spline_model_scores$logLik_Preferred_Model_Name == 2] <- "Either"

# Reorders the data frame to put all of the model scores together
spline_model_scores <- spline_model_scores[,c(1,2,3,8,9,4,5,10,11,6,7,12,13)]

# Verifies if the data frame has been completed correctly
head(spline_model_scores)
## # A tibble: 6 × 13
## # Groups:   Species [6]
##   Species Reflectance_AIC Log_Reflectance_AIC AIC_Preferred_Model_Score
##   <chr>             <dbl>               <dbl>                     <dbl>
## 1 TanCyo           -447.               -1746.                    -1746.
## 2 TanLab             94.0              -1355.                    -1355.
## 3 TanRue           -161.               -1471.                    -1471.
## 4 TanChi           -261.                -999.                     -999.
## 5 TanVel           -667.               -1691.                    -1691.
## 6 TanCal           -210.               -1636.                    -1636.
## # ℹ 9 more variables: AIC_Preferred_Model_Name <chr>, Reflectance_BIC <dbl>,
## #   Log_Reflectance_BIC <dbl>, BIC_Preferred_Model_Score <dbl>,
## #   BIC_Preferred_Model_Name <chr>, Reflectance_logLik <dbl>,
## #   Log_Reflectance_logLik <dbl>, logLik_Preferred_Model_Score <dbl>,
## #   logLik_Preferred_Model_Name <chr>

Step 8: Plotting model scores between datasets

Here, we want to plot the model scores from each of the datasets to each other. If our spline fits are identical, our model scores should fit along the line \(y=x\). For an inconclusive determination, we would see an even split around the line if there is not a strong preference present. Otherwise, we should expect to a vast majority of data points lying on one side of the line over the other.

# Create a vector of the color codes for each species to use in ggplot2 scatterplots
tanager_subset_colors <- c(spline_table[, "RGB_Color"])

# Puts the species name for each color as the names for the vector
names(tanager_subset_colors) <- spline_table$Species

# Character vector to be used as the title for our scatterplot legend (there could be other methods of doing this, but this was the one that I could figure out how to use with ggplot2)
title_for_legend <- "Species"


# AIC scores

# Scatterplot showing data spaced around the origin with y=x line present
(ggplot(data = spline_model_scores, aes(x = Reflectance_AIC, y = Log_Reflectance_AIC))
+ geom_point(aes(color = names(tanager_subset_colors)))
+ theme(legend.key.size = unit(0.5, "cm"))
+ geom_hline(yintercept = 0)
+ geom_vline(xintercept = 0)
+ geom_abline(intercept = 0, slope = 1)
+ xlab("Reflectance AIC Score")
+ ylab("Log Reflectance AIC Score")
+ ggtitle("AIC Scores", subtitle = "Log Reflectance vs. Reflectance Spline Fits")
+ scale_color_manual(title_for_legend,values = as.character(tanager_subset_colors))
)

# Scatterplot centered around the data
(ggplot(data = spline_model_scores, aes(x = Reflectance_AIC, y = Log_Reflectance_AIC))
+ geom_point(aes(color = names(tanager_subset_colors)))
+ theme(legend.key.size = unit(0.5, "cm"))
+ xlab("Reflectance AIC Score")
+ ylab("Log Reflectance AIC Score")
+ ggtitle("AIC Scores", subtitle = "Log Reflectance vs. Reflectance Spline Fits")
+ scale_color_manual(title_for_legend,values = as.character(tanager_subset_colors))
)

# BIC scores

# Scatterplot showing data spaced around the origin with y=x line present
(ggplot(data = spline_model_scores, aes(x = Reflectance_BIC, y = Log_Reflectance_BIC))
+ geom_point(aes(color = names(tanager_subset_colors))) 
+ theme(legend.key.size = unit(0.5, "cm"))
+ geom_hline(yintercept = 0)
+ geom_vline(xintercept = 0)
+ geom_abline(intercept = 0, slope = 1)
+ xlab("Reflectance BIC Score")
+ ylab("Log Reflectance BIC Score")
+ ggtitle("BIC Scores", subtitle = "Log Reflectance vs. Reflectance Spline Fits")
+ scale_color_manual(title_for_legend,values = as.character(tanager_subset_colors))
)

# Scatterplot centered around the data
(ggplot(data = spline_model_scores, aes(x = Reflectance_BIC, y = Log_Reflectance_BIC))
+ geom_point(aes(color = names(tanager_subset_colors)))
+ theme(legend.key.size = unit(0.5, "cm"))
+ xlab("Reflectance BIC Score")
+ ylab("Log Reflectance BIC Score")
+ ggtitle("BIC Scores", subtitle = "Log Reflectance vs. Reflectance Spline Fits")
+ scale_color_manual(title_for_legend,values = as.character(tanager_subset_colors))
)

# logLik scores

# Scatterplot showing data spaced around the origin with y=x line present
(ggplot(data = spline_model_scores, aes(x = Reflectance_logLik, y = Log_Reflectance_logLik)) + geom_point(aes(color = names(tanager_subset_colors)))
+ theme(legend.key.size = unit(0.5, "cm"))
+ xlab("Reflectance logLik Score") 
+ ylab("Log Reflectance logLik Score")
+ ggtitle("logLik Scores", subtitle = "Log Reflectance vs. Reflectance Spline Fits")
+ scale_color_manual(title_for_legend, values = as.character(tanager_subset_colors))
)

# Scatterplot centered around the data
(ggplot(data = spline_model_scores, aes(x = Reflectance_logLik, y = Log_Reflectance_logLik)) + geom_point(aes(color = names(tanager_subset_colors)))
+ theme(legend.key.size = unit(0.5, "cm"))
+ geom_hline(yintercept = 0)
+ geom_vline(xintercept = 0)
+ geom_abline(slope = 1, intercept = 0)
+ xlab("Reflectance logLik Score")
+ ylab("Log Reflectance logLik Score")
+ ggtitle("logLik Scores", subtitle = "Log Reflectance vs. Reflectance Spline Fits")
+ scale_color_manual(title_for_legend, values = as.character(tanager_subset_colors))
)

#Step 9: Summary statistics for 10nm wavelength bins from 300 to 700 nm

# Creates a data frame without a column for the wavelengths
tanData_filtered_wowl <- data.frame(tanData_filtered[-1])
# Transpose the data frame to put the species names as the rows
tanData_filtered_wowl <- t(tanData_filtered_wowl)

# Create a counting vector for our for loop below
wl_bins <- seq(1, 400, 10)

# Creates a wavelength vector to match our counting vector to what our binned wavelengths would be
wavelengths <- 300:700

# 3 blank vectors to add summary statistics to. Each respectively will contain the mean, variance, and standard deviation for each 10nm wavelength bin
wl_mean <- rep(NA, 40)
wl_var <- rep(NA, 40)
wl_sd <- rep(NA, 40)

# One vector to store the raw data and a blank data frame to store all of the reflectance values for each wavelength bin
wl_data <- NULL
wl_dataframe <- NA

# for loop to extract the mean, var, and sd from each wavelength bin by using a sequence of columns and performing a summary function on that group of data. Each value is stored in its respective vector and the data is stored within our data frame. For the final bin of data, which has length 11 rather than 10, we do not attach it to our data frame, and leave it stored in our wl_data vector.
for (i in 1:40){
  # Creates our 10nm bins up until 690 nm
  sequence <- seq(wl_bins[i],(wl_bins[i])+9, 1)
  
  # Verifies that our vector is working and can match it to our wavelength bins for future clarification
  print(sequence)
  print(wavelengths[sequence])

  # Summary stats are stored in their respective locations
  wl_mean[i] <- mean(tanData_filtered_wowl[,sequence])
  wl_var[i] <- var(tanData_filtered_wowl[,sequence])
  wl_sd[i] <- sd(tanData_filtered_wowl[,sequence])
  
  # Takes the reflectance values from our data frame and stores them in a vector
  wl_data <- c(tanData_filtered_wowl[,sequence])

  # Takes our vector and stores them within a data frame for future use
  wl_dataframe <- rbind(wl_dataframe, wl_data)
  
  # Need to add this condition due to unequal wavelength bin sizes
  if (i == 40){
    sequence <- 390:400
    print(sequence)
  
    wl_mean[i] <- mean(tanData_filtered_wowl[,sequence])
    wl_var[i] <- var(tanData_filtered_wowl[,sequence])
    wl_sd[i] <- sd(tanData_filtered_wowl[,sequence])
    
    wl_data <- c(tanData_filtered_wowl[,sequence])
  }
  
  # Verifies that the length of each bin is 10 nm intervals except for our final interval, which should be 11 nm
  print(length(wl_data))
  
  # Verifying that for loop worked by comparing the values of our summary stats from our extractions match to the initial dataset. If so, all values should return TRUE.
  test_mean <- (c(tanData_filtered_wowl[,sequence]))
  print(mean(test_mean) == wl_mean[i])
}
##  [1]  1  2  3  4  5  6  7  8  9 10
##  [1] 300 301 302 303 304 305 306 307 308 309
## [1] 510
## [1] TRUE
##  [1] 11 12 13 14 15 16 17 18 19 20
##  [1] 310 311 312 313 314 315 316 317 318 319
## [1] 510
## [1] TRUE
##  [1] 21 22 23 24 25 26 27 28 29 30
##  [1] 320 321 322 323 324 325 326 327 328 329
## [1] 510
## [1] TRUE
##  [1] 31 32 33 34 35 36 37 38 39 40
##  [1] 330 331 332 333 334 335 336 337 338 339
## [1] 510
## [1] TRUE
##  [1] 41 42 43 44 45 46 47 48 49 50
##  [1] 340 341 342 343 344 345 346 347 348 349
## [1] 510
## [1] TRUE
##  [1] 51 52 53 54 55 56 57 58 59 60
##  [1] 350 351 352 353 354 355 356 357 358 359
## [1] 510
## [1] TRUE
##  [1] 61 62 63 64 65 66 67 68 69 70
##  [1] 360 361 362 363 364 365 366 367 368 369
## [1] 510
## [1] TRUE
##  [1] 71 72 73 74 75 76 77 78 79 80
##  [1] 370 371 372 373 374 375 376 377 378 379
## [1] 510
## [1] TRUE
##  [1] 81 82 83 84 85 86 87 88 89 90
##  [1] 380 381 382 383 384 385 386 387 388 389
## [1] 510
## [1] TRUE
##  [1]  91  92  93  94  95  96  97  98  99 100
##  [1] 390 391 392 393 394 395 396 397 398 399
## [1] 510
## [1] TRUE
##  [1] 101 102 103 104 105 106 107 108 109 110
##  [1] 400 401 402 403 404 405 406 407 408 409
## [1] 510
## [1] TRUE
##  [1] 111 112 113 114 115 116 117 118 119 120
##  [1] 410 411 412 413 414 415 416 417 418 419
## [1] 510
## [1] TRUE
##  [1] 121 122 123 124 125 126 127 128 129 130
##  [1] 420 421 422 423 424 425 426 427 428 429
## [1] 510
## [1] TRUE
##  [1] 131 132 133 134 135 136 137 138 139 140
##  [1] 430 431 432 433 434 435 436 437 438 439
## [1] 510
## [1] TRUE
##  [1] 141 142 143 144 145 146 147 148 149 150
##  [1] 440 441 442 443 444 445 446 447 448 449
## [1] 510
## [1] TRUE
##  [1] 151 152 153 154 155 156 157 158 159 160
##  [1] 450 451 452 453 454 455 456 457 458 459
## [1] 510
## [1] TRUE
##  [1] 161 162 163 164 165 166 167 168 169 170
##  [1] 460 461 462 463 464 465 466 467 468 469
## [1] 510
## [1] TRUE
##  [1] 171 172 173 174 175 176 177 178 179 180
##  [1] 470 471 472 473 474 475 476 477 478 479
## [1] 510
## [1] TRUE
##  [1] 181 182 183 184 185 186 187 188 189 190
##  [1] 480 481 482 483 484 485 486 487 488 489
## [1] 510
## [1] TRUE
##  [1] 191 192 193 194 195 196 197 198 199 200
##  [1] 490 491 492 493 494 495 496 497 498 499
## [1] 510
## [1] TRUE
##  [1] 201 202 203 204 205 206 207 208 209 210
##  [1] 500 501 502 503 504 505 506 507 508 509
## [1] 510
## [1] TRUE
##  [1] 211 212 213 214 215 216 217 218 219 220
##  [1] 510 511 512 513 514 515 516 517 518 519
## [1] 510
## [1] TRUE
##  [1] 221 222 223 224 225 226 227 228 229 230
##  [1] 520 521 522 523 524 525 526 527 528 529
## [1] 510
## [1] TRUE
##  [1] 231 232 233 234 235 236 237 238 239 240
##  [1] 530 531 532 533 534 535 536 537 538 539
## [1] 510
## [1] TRUE
##  [1] 241 242 243 244 245 246 247 248 249 250
##  [1] 540 541 542 543 544 545 546 547 548 549
## [1] 510
## [1] TRUE
##  [1] 251 252 253 254 255 256 257 258 259 260
##  [1] 550 551 552 553 554 555 556 557 558 559
## [1] 510
## [1] TRUE
##  [1] 261 262 263 264 265 266 267 268 269 270
##  [1] 560 561 562 563 564 565 566 567 568 569
## [1] 510
## [1] TRUE
##  [1] 271 272 273 274 275 276 277 278 279 280
##  [1] 570 571 572 573 574 575 576 577 578 579
## [1] 510
## [1] TRUE
##  [1] 281 282 283 284 285 286 287 288 289 290
##  [1] 580 581 582 583 584 585 586 587 588 589
## [1] 510
## [1] TRUE
##  [1] 291 292 293 294 295 296 297 298 299 300
##  [1] 590 591 592 593 594 595 596 597 598 599
## [1] 510
## [1] TRUE
##  [1] 301 302 303 304 305 306 307 308 309 310
##  [1] 600 601 602 603 604 605 606 607 608 609
## [1] 510
## [1] TRUE
##  [1] 311 312 313 314 315 316 317 318 319 320
##  [1] 610 611 612 613 614 615 616 617 618 619
## [1] 510
## [1] TRUE
##  [1] 321 322 323 324 325 326 327 328 329 330
##  [1] 620 621 622 623 624 625 626 627 628 629
## [1] 510
## [1] TRUE
##  [1] 331 332 333 334 335 336 337 338 339 340
##  [1] 630 631 632 633 634 635 636 637 638 639
## [1] 510
## [1] TRUE
##  [1] 341 342 343 344 345 346 347 348 349 350
##  [1] 640 641 642 643 644 645 646 647 648 649
## [1] 510
## [1] TRUE
##  [1] 351 352 353 354 355 356 357 358 359 360
##  [1] 650 651 652 653 654 655 656 657 658 659
## [1] 510
## [1] TRUE
##  [1] 361 362 363 364 365 366 367 368 369 370
##  [1] 660 661 662 663 664 665 666 667 668 669
## [1] 510
## [1] TRUE
##  [1] 371 372 373 374 375 376 377 378 379 380
##  [1] 670 671 672 673 674 675 676 677 678 679
## [1] 510
## [1] TRUE
##  [1] 381 382 383 384 385 386 387 388 389 390
##  [1] 680 681 682 683 684 685 686 687 688 689
## [1] 510
## [1] TRUE
##  [1] 391 392 393 394 395 396 397 398 399 400
##  [1] 690 691 692 693 694 695 696 697 698 699
##  [1] 390 391 392 393 394 395 396 397 398 399 400
## [1] 561
## [1] TRUE
# Combines all of our summary stat vectors into a matrix
wl_summary_stats <- cbind(wl_mean, wl_var)
wl_summary_stats <- cbind(wl_summary_stats, wl_sd)

# Wavelength bin vector
binned_wl <- c("300-309","310-319","320-329","330-339","340-349","350-359", "360-369","370-379","380-389","390-399","400-409","410-419","420-429","430-439","440-449","450-459","460-469","470-479","480-489","490-499","500-509","510-519","520-529","530-539", "540-549","550-559","560-569","570-579","580-589","590-599","600-609","610-619","620-629","630-639","640-649","650-659","660-669","670-679","680-689","690-700")

# Applies our wavelength bins as names for our summary stat matrix
rownames(wl_summary_stats) <- binned_wl

# Turns our summary stat matrix into a data frame
wl_summary_stats <- data.frame(wl_summary_stats)

# Verifying that our data frame looks as it should
head(wl_summary_stats)
##           wl_mean    wl_var     wl_sd
## 300-309  7.336654  33.92732  6.584323
## 310-319  8.253758  57.95645  8.400906
## 320-329  9.143775  90.86186  9.794148
## 330-339  9.794497 108.62207 10.667116
## 340-349 10.323104 125.19166 11.548976
## 350-359 10.909315 149.43408 12.544971
# Transposes matrix to place wavelength bins as columns
wl_dataframe <- t(wl_dataframe)

# Removes both the NA column and the last column (690-700 nm) as this column has omitted data due to column length coercion (561 data points -> reduced to 510 data points)
wl_dataframe <- wl_dataframe[,2:40]

# Takes our dataframe and turns it into a singular vector, and adds our data points from 690-700 nm. We do this to use the boxplot function seamlessly.
wl_dataframe <- c(wl_dataframe, wl_data)


# Blank vector to store our wavelength bins to identify which values in wl_dataframe come from which wavelength bin
wl_ranges <- NULL

# for loop to create a long character vector listing each wavelength bin equal to number of data points from each wavelength bin
for (i in 1:40){
  if (i <= 39){
  
  x <- rep(binned_wl[i], 510)
  
  wl_ranges <- cbind(wl_ranges, x)
  
  }
  
    if (i == 40){
    
    x <- rep(binned_wl[i], 561)
    wl_ranges <- c(wl_ranges, x)
      
    }
}

# Binds our reflectance data to each wavelength bin into a matrix
wl_dataframe <- cbind(wl_dataframe, wl_ranges)

# Verifies matrix was formed correctly
head(wl_dataframe)
##      wl_dataframe       wl_ranges
## [1,] "4.68574356499623" "300-309"
## [2,] "8.74218558557998" "300-309"
## [3,] "5.00206306306269" "300-309"
## [4,] "1.54676756757055" "300-309"
## [5,] "3.54724108108108" "300-309"
## [6,] "3.93986486487487" "300-309"
# Adds names to our matrix
colnames(wl_dataframe) <- c("Reflectance_Values", "Wavelength_Bins")

# Converts our matrix into a data frame
wl_dataframe <- data.frame(wl_dataframe)

# Checks that our reflectance values are numerical values and that our wavelength bins are character values
str(wl_dataframe)
## 'data.frame':    20451 obs. of  2 variables:
##  $ Reflectance_Values: chr  "4.68574356499623" "8.74218558557998" "5.00206306306269" "1.54676756757055" ...
##  $ Wavelength_Bins   : chr  "300-309" "300-309" "300-309" "300-309" ...
# Converts our Reflectance_Values column into numerical values to use for our boxplot
wl_dataframe$Reflectance_Values <- as.numeric(wl_dataframe$Reflectance_Values)

# Verifies if our Reflectance_Values column is now numerical values
str(wl_dataframe)
## 'data.frame':    20451 obs. of  2 variables:
##  $ Reflectance_Values: num  4.69 8.74 5 1.55 3.55 ...
##  $ Wavelength_Bins   : chr  "300-309" "300-309" "300-309" "300-309" ...
# Sequence vector with the midpoints of our wavelength bins
sequence <- seq(305, 695, 10)

# Blank vectors to store RGB codes into
color_for_plots_V1 <- NULL
color_for_plots_V2 <- NULL
color_for_plots_V3 <- NULL
color_for_plots_V4 <- NULL

# for loop to generate different color options for the boxplots. Here we parameterize different Gaussian curves of spectra at the midpoint of each wavelength interval with varying widths and heights of our curves.
for (i in 1:length(sequence)){
  
  color_for_plots_V1[i] <- spec2rgb(simulate_spec(wl_peak = sequence[i]))
  
  color_for_plots_V2[i] <- spec2rgb(simulate_spec(wl_peak = sequence[i], width_gauss = 10))
  
  color_for_plots_V3[i] <- spec2rgb(simulate_spec(wl_peak = sequence[i], width_gauss = 10, ylim = c(0, wl_summary_stats[i,1])))
  
  color_for_plots_V4[i] <- spec2rgb(simulate_spec(wl_peak = sequence[i], ylim = c(0, wl_summary_stats[i,1])))
}


# Boxplots of the reflectance data for each wavelength bin with different color options

boxplot(data = wl_dataframe, Reflectance_Values~Wavelength_Bins, col = color_for_plots_V1, main = "Summary Statistics for Thraupidae Crown Reflectance (51 Species)", xlab = "Wavelength Bins (10nm Intervals)", ylab = "Reflectance (%)")

boxplot(data = wl_dataframe, Reflectance_Values~Wavelength_Bins, col = color_for_plots_V2, main = "Summary Statistics for Thraupidae Crown Reflectance (51 Species)", xlab = "Wavelength Bins (10nm Intervals)", ylab = "Reflectance (%)")

boxplot(data = wl_dataframe, Reflectance_Values~Wavelength_Bins, col = color_for_plots_V3, main = "Summary Statistics for Thraupidae Crown Reflectance (51 Species)", xlab = "Wavelength Bins (10nm Intervals)", ylab = "Reflectance (%)")

boxplot(data = wl_dataframe, Reflectance_Values~Wavelength_Bins, col = color_for_plots_V4, main = "Summary Statistics for Thraupidae Crown Reflectance (51 Species)", xlab = "Wavelength Bins (10nm Intervals)", ylab = "Reflectance (%)")

Step 10: Spline Coefficient Extraction for BEAST

# Empty matrix for the spline coefficients
spline_coef_data <- NA

# for loop to extract spline coefficients for each species from our spline_results (list)
for (species_name in names(spline_results)){
  
  name_vector <- as.character(species_name)
  
  spline_coefficients <- spline_results[[name_vector]]
  
  spline_coefficients <- spline_coefficients$reflectance_coef
  
  spline_coef_data <- rbind(spline_coef_data, spline_coefficients)
  
  
}

# Removes NA row
spline_coef_data <- spline_coef_data[-1,]

# Turns our matrix into a data frame
spline_coef_data <- data.frame(spline_coef_data)

# Adds species labels to each row of spline coefficients
rownames(spline_coef_data) <- names(spline_results)

# Explicit species name vector to add to our data frame
species <- as.character(names(spline_results))

# Adds a species name vector to our data frame. This is needed for BEAST to know what spline coefficients are for each species
spline_coef_data <- cbind(species, spline_coef_data)

# Vector containing the names of the species column and each spline coefficient extracted
coefficient_names <- c("Species", "Intercept", "Coefficient.1","Coefficient.2","Coefficient.3","Coefficient.4","Coefficient.5","Coefficient.6","Coefficient.7","Coefficient.8","Coefficient.9","Coefficient.10","Coefficient.11","Coefficient.12","Coefficient.13","Coefficient.14","Coefficient.15","Coefficient.16","Coefficient.17","Coefficient.18","Coefficient.19","Coefficient.20","Coefficient.21","Coefficient.22","Coefficient.23","Coefficient.24","Coefficient.25","Coefficient.26","Coefficient.27","Coefficient.28","Coefficient.29","Coefficient.30","Coefficient.31","Coefficient.32","Coefficient.33","Coefficient.34","Coefficient.35","Coefficient.36","Coefficient.37","Coefficient.38")

# Applies our coefficient name vector to our data frame
colnames(spline_coef_data) <- coefficient_names

# Verifies our data is in a data frame
str(spline_coef_data)
## 'data.frame':    51 obs. of  40 variables:
##  $ Species       : chr  "TanCyo" "TanLab" "TanRue" "TanChi" ...
##  $ Intercept     : num  4.69 8.74 5 1.55 3.55 ...
##  $ Coefficient.1 : num  -1.95 3.72 0.82 1.35 1.24 2.11 0.4 -0.17 0.48 2.22 ...
##  $ Coefficient.2 : num  2.17 -5.3 -0.09 -0.19 0.14 0.78 1.14 1.54 -0.39 -1.14 ...
##  $ Coefficient.3 : num  0.58 1.19 -0.08 1.46 0.04 2.27 -1.12 1.37 -1.98 -2.47 ...
##  $ Coefficient.4 : num  2.96 -2.37 0.15 0.56 0.4 2.31 1.19 3.12 -0.77 -0.73 ...
##  $ Coefficient.5 : num  2.43 -3.35 0.26 0.57 0.06 3.22 0.19 1.65 -0.22 0.45 ...
##  $ Coefficient.6 : num  1.04 -3.7 0.46 0.57 0.67 3.33 1.09 2.08 1.23 -0.08 ...
##  $ Coefficient.7 : num  2.21 -4.4 1.22 0.69 -0.29 3.9 0.74 2.76 2.27 2.47 ...
##  $ Coefficient.8 : num  1.82 -4.37 2.11 1.05 -0.08 4.91 1.22 2.61 4.01 3.68 ...
##  $ Coefficient.9 : num  1.93 -3.82 2.34 1.26 0.18 5.57 1.4 3.16 5.47 5.14 ...
##  $ Coefficient.10: num  1.81 -3.39 2.73 0.99 0.1 6.93 0.89 3.62 7.28 7.63 ...
##  $ Coefficient.11: num  2.03 -3.2 2.91 0.73 0.54 ...
##  $ Coefficient.12: num  2 -2.93 3.06 0.39 0.76 ...
##  $ Coefficient.13: num  2.36 -2.16 3.45 0.37 1.55 ...
##  $ Coefficient.14: num  2.73 -1.96 3.88 0.46 2.23 ...
##  $ Coefficient.15: num  3.21 -1.35 4.91 0.26 3.07 ...
##  $ Coefficient.16: num  3.87 -0.52 5.62 0.38 3.71 ...
##  $ Coefficient.17: num  4.33 0.41 7.54 0.95 4.1 ...
##  $ Coefficient.18: num  4.68 0.81 8.41 0.5 3.68 ...
##  $ Coefficient.19: num  5.22 2.97 11.13 0.3 2.89 ...
##  $ Coefficient.20: num  5.37 3.67 13.4 7.54 2.1 ...
##  $ Coefficient.21: num  5.47 4.39 16.33 34.96 1.38 ...
##  $ Coefficient.22: num  5.42 5.24 18.65 46.12 1.08 ...
##  $ Coefficient.23: num  5.15 5.24 20.66 56.4 0.88 ...
##  $ Coefficient.24: num  5.21 5.53 21.7 64.09 0.9 ...
##  $ Coefficient.25: num  4.48 5.12 20.51 65.77 0.91 ...
##  $ Coefficient.26: num  4.25 4.02 18.01 61.82 0.78 ...
##  $ Coefficient.27: num  3.78 3.55 14.92 52.02 0.98 ...
##  $ Coefficient.28: num  3.03 2.66 11.61 40.41 0.78 ...
##  $ Coefficient.29: num  2.75 2.07 9.33 30.95 0.95 ...
##  $ Coefficient.30: num  2.14 1.9 7.5 23.94 0.8 ...
##  $ Coefficient.31: num  2.17 1.99 6.52 19.55 1.17 ...
##  $ Coefficient.32: num  2.39 0.71 5.85 17.1 0.97 ...
##  $ Coefficient.33: num  1.74 0.99 5.63 15.73 1.25 ...
##  $ Coefficient.34: num  1.88 2.1 4.63 13.86 0.99 ...
##  $ Coefficient.35: num  1.28 0.76 4.8 13.96 1.26 ...
##  $ Coefficient.36: num  2.3 3.98 4.96 12.72 1.52 ...
##  $ Coefficient.37: num  1.5 1.55 4.76 12.91 1.57 ...
##  $ Coefficient.38: num  2.08 2.86 4.96 12.59 1.5 ...
# Writes a text file of our data frame to use for BEAST
write_tsv(spline_coef_data, file = "spline_coefficients_BEAST.txt")

Step 11: OUTLINING BEAST AND TRACER PROCESS

Step 12: Analyzing diffusion rates of spline coefficients

# Loads in the .txt file containing our diffusion rate data for our spline coefficients
coefficient_diffusion_rates <- read.delim("diffusion_rate_data.txt")

# Manually written vector to contain an ordered list of the spline coefficients
coefficient_diffusion_rates_names <- c("Intercept.diffusionRate", "Coefficient.1.diffusionRate","Coefficient.2.diffusionRate","Coefficient.3.diffusionRate","Coefficient.4.diffusionRate","Coefficient.5.diffusionRate","Coefficient.6.diffusionRate","Coefficient.7.diffusionRate","Coefficient.8.diffusionRate","Coefficient.9.diffusionRate","Coefficient.10.diffusionRate","Coefficient.11.diffusionRate","Coefficient.12.diffusionRate","Coefficient.13.diffusionRate","Coefficient.14.diffusionRate","Coefficient.15.diffusionRate","Coefficient.16.diffusionRate","Coefficient.17.diffusionRate","Coefficient.18.diffusionRate","Coefficient.19.diffusionRate","Coefficient.20.diffusionRate","Coefficient.21.diffusionRate","Coefficient.22.diffusionRate","Coefficient.23.diffusionRate","Coefficient.24.diffusionRate","Coefficient.25.diffusionRate","Coefficient.26.diffusionRate","Coefficient.27.diffusionRate","Coefficient.28.diffusionRate","Coefficient.29.diffusionRate","Coefficient.30.diffusionRate","Coefficient.31.diffusionRate","Coefficient.32.diffusionRate","Coefficient.33.diffusionRate","Coefficient.34.diffusionRate","Coefficient.35.diffusionRate","Coefficient.36.diffusionRate","Coefficient.37.diffusionRate","Coefficient.38.diffusionRate")

# Blank vector to store the order of the columns in relation to the order of our spline coefficient names vector
diffusion_rate_column_order <- NULL

# for loop to figure out the location of each column to to put it in sequential order (Intercept, 1, 2, ..., 38). This step is necessary as the columns are not in this sequential order when extracted from BEAST.
for (i in 1:length(coefficient_diffusion_rates_names)){
  diffusion_rate_column_order[i] <- which(coefficient_diffusion_rates_names[i] == colnames(coefficient_diffusion_rates))
    print(which(coefficient_diffusion_rates_names[i] == colnames(coefficient_diffusion_rates)))
}
## [1] 2
## [1] 39
## [1] 37
## [1] 35
## [1] 33
## [1] 31
## [1] 29
## [1] 27
## [1] 25
## [1] 4
## [1] 16
## [1] 14
## [1] 20
## [1] 18
## [1] 9
## [1] 7
## [1] 12
## [1] 11
## [1] 23
## [1] 22
## [1] 24
## [1] 36
## [1] 34
## [1] 40
## [1] 38
## [1] 28
## [1] 26
## [1] 32
## [1] 30
## [1] 3
## [1] 6
## [1] 5
## [1] 17
## [1] 15
## [1] 21
## [1] 19
## [1] 10
## [1] 8
## [1] 13
# Reorders the columns of our data frame to match the sequential order that we would like
coefficient_diffusion_rates <- coefficient_diffusion_rates[,c(1,diffusion_rate_column_order)]

# Verifies that we have the correct order that we are looking for
head(coefficient_diffusion_rates)
##   Summary.Statistic Intercept.diffusionRate Coefficient.1.diffusionRate
## 1              mean                  0.7889                      0.0847
## 2    stderr of mean               7.4599E-4                   7.9451E-5
## 3             stdev                  0.0693                   7.5383E-3
## 4          variance                4.798E-3                   5.6825E-5
## 5            median                  0.7838                      0.0839
## 6       value range        [0.5862, 1.1051]            [0.0649, 0.1245]
##   Coefficient.2.diffusionRate Coefficient.3.diffusionRate
## 1                       0.141                      0.1607
## 2                   1.5355E-4                   1.5071E-4
## 3                      0.0144                       0.014
## 4                   2.0831E-4                   1.9613E-4
## 5                      0.1399                      0.1594
## 6            [0.1006, 0.2095]            [0.1198, 0.2386]
##   Coefficient.4.diffusionRate Coefficient.5.diffusionRate
## 1                      0.2078                       0.248
## 2                   1.9842E-4                   2.3044E-4
## 3                      0.0182                      0.0217
## 4                   3.3159E-4                   4.7245E-4
## 5                      0.2063                      0.2464
## 6             [0.1531, 0.295]            [0.1865, 0.3428]
##   Coefficient.6.diffusionRate Coefficient.7.diffusionRate
## 1                      0.3139                        0.41
## 2                   2.9559E-4                   4.0954E-4
## 3                       0.028                      0.0389
## 4                   7.8654E-4                   1.5098E-3
## 5                      0.3114                      0.4075
## 6            [0.2327, 0.4463]            [0.2934, 0.5886]
##   Coefficient.8.diffusionRate Coefficient.9.diffusionRate
## 1                      0.4596                      0.5418
## 2                   4.5214E-4                   5.3323E-4
## 3                      0.0429                      0.0505
## 4                   1.8403E-3                   2.5525E-3
## 5                      0.4557                      0.5374
## 6            [0.3397, 0.7508]            [0.3949, 0.7961]
##   Coefficient.10.diffusionRate Coefficient.11.diffusionRate
## 1                       0.5782                       0.6052
## 2                    5.7773E-4                    5.5716E-4
## 3                       0.0534                       0.0529
## 4                    2.8497E-3                    2.7945E-3
## 5                       0.5732                        0.601
## 6             [0.4268, 0.8909]              [0.4481, 0.919]
##   Coefficient.12.diffusionRate Coefficient.13.diffusionRate
## 1                       0.6662                       0.7045
## 2                    6.0489E-4                    6.3682E-4
## 3                       0.0574                       0.0604
## 4                    3.2938E-3                    3.6507E-3
## 5                       0.6618                       0.6994
## 6             [0.5056, 0.9925]             [0.5319, 1.0384]
##   Coefficient.14.diffusionRate Coefficient.15.diffusionRate
## 1                       0.7457                       0.8174
## 2                    6.5697E-4                    7.2804E-4
## 3                       0.0623                       0.0681
## 4                    3.8854E-3                    4.6422E-3
## 5                       0.7394                       0.8124
## 6             [0.5575, 1.1383]              [0.6132, 1.155]
##   Coefficient.16.diffusionRate Coefficient.17.diffusionRate
## 1                       0.9074                       0.9794
## 2                    8.1902E-4                    9.1573E-4
## 3                       0.0777                       0.0869
## 4                    6.0385E-3                    7.5488E-3
## 5                       0.9009                       0.9728
## 6             [0.6956, 1.3639]             [0.7361, 1.3948]
##   Coefficient.18.diffusionRate Coefficient.19.diffusionRate
## 1                       1.1441                       1.3761
## 2                    1.0405E-3                    1.2015E-3
## 3                       0.0987                        0.114
## 4                    9.7455E-3                        0.013
## 5                       1.1344                       1.3653
## 6              [0.8812, 1.609]             [1.0594, 2.1527]
##   Coefficient.20.diffusionRate Coefficient.21.diffusionRate
## 1                       1.5738                       1.7365
## 2                    1.3426E-3                    1.4869E-3
## 3                       0.1274                       0.1411
## 4                       0.0162                       0.0199
## 5                       1.5622                       1.7243
## 6             [1.2331, 2.4099]             [1.3602, 2.5605]
##   Coefficient.22.diffusionRate Coefficient.23.diffusionRate
## 1                       1.8698                       1.9051
## 2                     1.639E-3                    1.6759E-3
## 3                       0.1555                        0.159
## 4                       0.0242                       0.0253
## 5                       1.8569                       1.8902
## 6             [1.4358, 2.7609]             [1.4622, 2.8717]
##   Coefficient.24.diffusionRate Coefficient.25.diffusionRate
## 1                       1.9027                       1.8305
## 2                    1.6878E-3                    1.6243E-3
## 3                       0.1601                       0.1541
## 4                       0.0256                       0.0238
## 5                       1.8895                       1.8185
## 6             [1.4802, 2.8253]             [1.3901, 2.8393]
##   Coefficient.26.diffusionRate Coefficient.27.diffusionRate
## 1                       1.7893                       1.7626
## 2                    1.6075E-3                    1.5942E-3
## 3                       0.1525                       0.1513
## 4                       0.0233                       0.0229
## 5                       1.7754                       1.7482
## 6              [1.3618, 2.582]             [1.3686, 2.5505]
##   Coefficient.28.diffusionRate Coefficient.29.diffusionRate
## 1                       1.7516                       1.7874
## 2                     1.709E-3                    1.6968E-3
## 3                       0.1531                       0.1584
## 4                       0.0235                       0.0251
## 5                       1.7394                       1.7744
## 6             [1.3274, 2.5137]             [1.3536, 2.4627]
##   Coefficient.30.diffusionRate Coefficient.31.diffusionRate
## 1                       1.7982                        1.826
## 2                    1.6886E-3                    1.7192E-3
## 3                        0.159                       0.1631
## 4                       0.0253                       0.0266
## 5                        1.783                       1.8121
## 6              [1.353, 2.5747]             [1.3957, 2.8119]
##   Coefficient.32.diffusionRate Coefficient.33.diffusionRate
## 1                       1.8242                       1.8127
## 2                     1.722E-3                    1.7893E-3
## 3                       0.1634                       0.1657
## 4                       0.0267                       0.0274
## 5                       1.8083                       1.7973
## 6              [1.413, 2.6264]              [1.383, 2.7605]
##   Coefficient.34.diffusionRate Coefficient.35.diffusionRate
## 1                       1.8124                       1.7676
## 2                    1.7948E-3                    1.6884E-3
## 3                       0.1641                       0.1571
## 4                       0.0269                       0.0247
## 5                       1.7981                       1.7537
## 6             [1.3596, 2.7901]             [1.3141, 2.6808]
##   Coefficient.36.diffusionRate Coefficient.37.diffusionRate
## 1                       1.7278                       1.7082
## 2                    1.6297E-3                    1.6012E-3
## 3                       0.1546                       0.1519
## 4                       0.0239                       0.0231
## 5                       1.7142                       1.6958
## 6             [1.2808, 2.5323]             [1.3346, 2.5223]
##   Coefficient.38.diffusionRate
## 1                       1.6831
## 2                    1.5838E-3
## 3                       0.1479
## 4                       0.0219
## 5                       1.6699
## 6             [1.2495, 2.4557]
# Transposes the data frame to make the coefficients the rows
coefficient_diffusion_rates <- t(coefficient_diffusion_rates)

# When transposing the data frame, our data frame became a matrix, and here we convert it back into a data frame
coefficient_diffusion_rates <- data.frame(coefficient_diffusion_rates)

# Turns the column names with the values in the first row
colnames(coefficient_diffusion_rates) <- coefficient_diffusion_rates[1,]

# We remove the first row as they are now the column names for our data frame
coefficient_diffusion_rates <- coefficient_diffusion_rates[-1,]

# Verifies the structure of our object. We can see that all numerical values had been coerced into character vectors
str(coefficient_diffusion_rates)
## 'data.frame':    39 obs. of  11 variables:
##  $ mean                       : chr  "0.7889" "0.0847" "0.141" "0.1607" ...
##  $ stderr of mean             : chr  "7.4599E-4" "7.9451E-5" "1.5355E-4" "1.5071E-4" ...
##  $ stdev                      : chr  "0.0693" "7.5383E-3" "0.0144" "0.014" ...
##  $ variance                   : chr  "4.798E-3" "5.6825E-5" "2.0831E-4" "1.9613E-4" ...
##  $ median                     : chr  "0.7838" "0.0839" "0.1399" "0.1594" ...
##  $ value range                : chr  "[0.5862, 1.1051]" "[0.0649, 0.1245]" "[0.1006, 0.2095]" "[0.1198, 0.2386]" ...
##  $ geometric mean             : chr  "0.7859" "0.0843" "0.1403" "0.1601" ...
##  $ 95% HPD interval           : chr  "[0.6606, 0.9279]" "[0.0701, 0.0989]" "[0.1151, 0.171]" "[0.1355, 0.1895]" ...
##  $ auto-correlation time (ACT): chr  "1044.1002" "1000" "1018.8544" "1042.5656" ...
##  $ effective sample size (ESS): chr  "8620.8" "9001" "8834.4" "8633.5" ...
##  $ number of samples          : chr  "9001" "9001" "9001" "9001" ...
# for loop to convert all columns into numerical values rather than character values (with the exception of the 95% HPD interval and value range columns as there are not singular values and do not work the as.numeric function)
for (i in c(1:5,7,9:11)){
coefficient_diffusion_rates[,i] <- as.numeric(coefficient_diffusion_rates[,i])
}

# Verifies that the columns that we converted are now numeric in nature
str(coefficient_diffusion_rates)
## 'data.frame':    39 obs. of  11 variables:
##  $ mean                       : num  0.7889 0.0847 0.141 0.1607 0.2078 ...
##  $ stderr of mean             : num  7.46e-04 7.95e-05 1.54e-04 1.51e-04 1.98e-04 ...
##  $ stdev                      : num  0.0693 0.00754 0.0144 0.014 0.0182 ...
##  $ variance                   : num  4.80e-03 5.68e-05 2.08e-04 1.96e-04 3.32e-04 ...
##  $ median                     : num  0.7838 0.0839 0.1399 0.1594 0.2063 ...
##  $ value range                : chr  "[0.5862, 1.1051]" "[0.0649, 0.1245]" "[0.1006, 0.2095]" "[0.1198, 0.2386]" ...
##  $ geometric mean             : num  0.7859 0.0843 0.1403 0.1601 0.207 ...
##  $ 95% HPD interval           : chr  "[0.6606, 0.9279]" "[0.0701, 0.0989]" "[0.1151, 0.171]" "[0.1355, 0.1895]" ...
##  $ auto-correlation time (ACT): num  1044 1000 1019 1043 1069 ...
##  $ effective sample size (ESS): num  8621 9001 8834 8634 8421 ...
##  $ number of samples          : num  9001 9001 9001 9001 9001 ...
# Scatterplot showing the mean diffusion rate values for our spline coefficients, showing error bars equivalent to +/- 1 standard deviation
(ggplot(coefficient_diffusion_rates, aes(x = 0:38, y = mean))
+ geom_errorbar(aes(ymax = mean+stdev, ymin = mean-stdev), color = "orangered")
+ geom_point(color = "royalblue")
+ ggtitle("Diffusion Rates for Spline Coefficients", subtitle = "0 = Intercept Coefficient")
+ xlab("Spline Coefficients")
+ ylab("Diffusion Rate")
)

Step 13: Reconstucting splines (methods)

One of the main points of reconstructing splines is that we need to do it without the predictive power of a generalized least squares model, which is how we did it in Step 5. This is due to the fact that when we allow our coefficients to diffuse in BEAST for an ancestral state reconstruction (ASR), the only things that we have to reconstruct our diffused splines will just be diffused coefficients and the basis that we are working with (300-700 nm). Below, I will use a case study, using TanCyo (Tangara cyanotis) to show how we can construct splines for a species without the need for a least squares model.

Spline Reconstruction from gls function

# Extracting all of the data from our fit_splines function into a new object (named after our focal species)
TanCyo <- spline_results[["TanCyo"]]

# Here we plot a scatterplot using the predicted points from our gls model for this species
plot(x = 300:700, y = predict(TanCyo$reflectance_spline_fit), col = TanCyo$reflectance_rgb, pch = 19, xlab = "Wavelength (nm)", ylab = " Reflectance (%)", main = "TanCyo gls Spline Reconstruction")

# Side-by-side plot comparison of our gls reconstructed plot and the plot from Step 5 (using the actual reflectance data)

par(mfrow=c(1,2), mar = c(5.1,4.1,4.1,1.1))

plot(x = 300:700, y = predict(TanCyo$reflectance_spline_fit), col = TanCyo$reflectance_rgb, pch = 19, xlab = "Wavelength (nm)", ylab = " Reflectance (%)", main = "gls Spline Reconstruction", cex = 0.6)
mtext("TanCyo", col = "blue", side = 3, line = 0.5, cex = 0.8)

plot(tanData_filtered$wl, tanData_filtered$TanCyo, type = "p", pch = 16, cex = 0.5,  # Adjusted size of points
     col = adjustcolor("black", alpha.f = 0.5),  # Adjusted transparency of points
     main = paste("Cubic Splines (Refl.) -", "TanCyo"),
     xlab = "Wavelength (nm)", ylab = "Reflectance (%)")
lines(tanData_filtered$wl, predict(spline_results[["TanCyo"]]$reflectance_spline_fit), col = rgb_colors[["TanCyo"]], lwd = 2)
mtext(paste("AIC:", round(spline_results[["TanCyo"]]$reflectance_AIC, 3), "BIC:", round(spline_results[["TanCyo"]]$reflectance_BIC, 2), "logLik:", round(spline_results[["TanCyo"]]$reflectance_logLik)),
      side = 3, line = 0.5, cex = 0.8, col = "blue")

par(mfrow=c(1,1), mar = c(5.1,4.1,4.1,2.1))

Spline Reconstruction with only spline coefficients and a basis

I could not find an intuitive way to do this through just base R, but by using the package splines2, I am able to reconstruct the splines with just this information available.

# Creating a basis matrix using the function bSpline from the splines2 package. We use the same wavelength range and maintain the same degrees of freedom (35 knots)
bspline_matrix_bSpline <- bSpline(tanData_filtered$wl, df = 38)

# Verifying that the bSpline and bs functions produce identical basis matrices (output should be TRUE)
identical(data.frame(bs(tanData_filtered$wl, df = 38)), data.frame(bSpline(tanData_filtered$wl, df = 38)))
## [1] TRUE
# Extract the coefficients available to us from our gls model fit into its own vector
TanCyo_spline_coefficients <- TanCyo$reflectance_coef

# Must make coefficients from 2:39 as bSpline function does not create an intercept coefficient in its output, and therefore cannot use it in reconstructions
coef_spline_reconstruction <- cbind(300:700, predict(bspline_matrix_bSpline, coef = as.numeric(c(TanCyo_spline_coefficients[2:39]))))

# Adds names to the columns of the matrix
colnames(coef_spline_reconstruction) <- c("wl", "reflectance")

# Turns the matrix into a data frame
coef_spline_reconstruction <- data.frame(coef_spline_reconstruction)

# Code to show why we need to use the splines2 package
# Basis matrix produced by the function bs
bspline_matrix_bs <- bs(tanData_filtered$wl, df = 38)

# Object that would be created using the bs produced matrix. The output is another matrix
str(predict(bspline_matrix_bs, coef = as.numeric(c(TanCyo_spline_coefficients[2:39]))))
##  'bs' num [1:401, 1:38] 0 0.235 0.404 0.516 0.578 ...
##  - attr(*, "dimnames")=List of 2
##   ..$ : NULL
##   ..$ : chr [1:38] "1" "2" "3" "4" ...
##  - attr(*, "degree")= int 3
##  - attr(*, "knots")= num [1:35] 311 322 333 344 356 ...
##  - attr(*, "Boundary.knots")= int [1:2] 300 700
##  - attr(*, "intercept")= logi FALSE
# Object that would be created using the bSpline produced matrix. The output is a one column matrix (or a vector)
str(predict(bspline_matrix_bSpline, coef = as.numeric(c(TanCyo_spline_coefficients[2:39]))))
##  num [1:401] 0 -0.433 -0.694 -0.807 -0.794 ...
# Plotting the spline reconstruction using our matrix/coef method
plot(x = 300:700, y = coef_spline_reconstruction$reflectance, pch = 19, main = "TanCyo Coefficient Spline Reconstruction", xlab = "Wavelength (nm)", ylab = "Reflectance (%)", col = spec2rgb(procspec(as.rspec(coef_spline_reconstruction), fixneg = "zero")))
## wavelengths found in column 1
## The spectral data contain 7 negative value(s),
##  which may produce unexpected results if used in models.
## Consider using procspec() to correct them.
## processing options applied:
## Negative value correction: converted negative values to zero

# Side-by-side plots of the gls reconstruction and matrix/coef reconstruction
par(mfrow=c(1,2), mar = c(5.1,4.1,4.1,1.1))

plot(x = 300:700, y = predict(TanCyo$reflectance_spline_fit), col = TanCyo$reflectance_rgb, pch = 19, xlab = "Wavelength (nm)", ylab = " Reflectance (%)", main = "gls Spline Reconstruction", cex = 1)
mtext("TanCyo", col = "blue", side = 3, line = 0.5, cex = 0.8)


plot(x = 300:700, y = coef_spline_reconstruction$reflectance, pch = 19, main = "Coefficient Spline Reconst.", xlab = "Wavelength (nm)", ylab = "Reflectance (%)", col = spec2rgb(procspec(as.rspec(coef_spline_reconstruction), fixneg = "zero")))
## wavelengths found in column 1
## The spectral data contain 7 negative value(s),
##  which may produce unexpected results if used in models.
## Consider using procspec() to correct them.
## processing options applied:
## Negative value correction: converted negative values to zero
mtext("TanCyo", col = "blue", side = 3, line = 0.5, cex = 0.8)

par(mfrow=c(1,1), mar = c(5.1,4.1,4.1,2.1))

From the plots above, we can see two key differences from our initial plot. The first is that the color between the plots. The gls plot has an RGB color of #52574BFF, while the coefficient method has a color of #303F2EFF. The next major difference (and directly impacts why there is a color change), is that the reflectance scales are completely different from another, with all values on the left plot being greater than 0, while the data points on the right plot do not follow that trend. So if using a basis and spline coefficients to rebuild a curve, will we lose all of the biological information, where we only retain the shape of the curve? No. Earlier in our reconstruction, we mentioned that we had to omit the intercept coefficient due to predict(bspline_matrix_bSpline, coef = as.numeric(c(TanCyo_spline_coefficients[2:39]))) not being able to use it. But the intercept coefficient is important in dictating where to place the spline along the y-axis, thus all we have to do to our data is to add the spline coefficient value to all of our data points.

# Prints TanCyo intercept coefficient
TanCyo$reflectance_coef[1]
## (Intercept) 
##        4.69
# Plots the reconstructed splines from the matrix/coef method but adds the intercept values to the reconstructed reflectance values
plot(x = 300:700, y = coef_spline_reconstruction$reflectance + TanCyo$reflectance_coef[1], pch = 19, main = "Coefficient Spline Reconst.", xlab = "Wavelength (nm)", ylab = "Reflectance (%)", col = spec2rgb(procspec(as.rspec(coef_spline_reconstruction), fixneg = "zero")))
mtext("TanCyo", col = "blue", side = 3, line = 0.5, cex = 0.8)

# Copies our coef_spline_reconstruction data frame
coef_spline_reconstruction_plusintercept <- coef_spline_reconstruction

# Adds the intercept coefficient value to all of the reflectance values
coef_spline_reconstruction_plusintercept$reflectance <- coef_spline_reconstruction_plusintercept$reflectance + TanCyo$reflectance_coef[1]

# Side-by-side plots of the initial data, gls reconstruction, matrix/coef reconstruction, modified matrix/coef reconstruction
par(mfrow=c(2,2), mar = c(5.1,4.1,4.1,1.1))

plot(tanData_filtered$wl, tanData_filtered$TanCyo, type = "p", pch = 16, cex = 0.5,  # Adjusted size of points
     col = adjustcolor("black", alpha.f = 0.5),  # Adjusted transparency of points
     main = paste("Cubic Splines (Refl.) -", "TanCyo"),
     xlab = "Wavelength (nm)", ylab = "Reflectance (%)")
lines(tanData_filtered$wl, predict(spline_results[["TanCyo"]]$reflectance_spline_fit), col = rgb_colors[["TanCyo"]], lwd = 2)
mtext(paste("AIC:", round(spline_results[["TanCyo"]]$reflectance_AIC, 3), "BIC:", round(spline_results[["TanCyo"]]$reflectance_BIC, 2), "logLik:", round(spline_results[["TanCyo"]]$reflectance_logLik)),
      side = 3, line = 0.5, cex = 0.8, col = "blue")

plot(x = 300:700, y = predict(TanCyo$reflectance_spline_fit), col = TanCyo$reflectance_rgb, pch = 19, xlab = "Wavelength (nm)", ylab = " Reflectance (%)", main = "gls Spline Reconstruction", cex = 0.6)
mtext("TanCyo", col = "blue", side = 3, line = 0.5, cex = 0.8)


plot(x = 300:700, y = coef_spline_reconstruction$reflectance, pch = 19, main = "Coefficient Spline Reconst.", xlab = "Wavelength (nm)", ylab = "Reflectance (%)", cex = 0.6, col = spec2rgb(procspec(as.rspec(coef_spline_reconstruction), fixneg = "zero")))
mtext("TanCyo", col = "blue", side = 3, line = 0.5, cex = 0.8)

plot(x = 300:700, y = coef_spline_reconstruction_plusintercept$reflectance, pch = 19, main = "Coefficient Spline Reconst.", xlab = "Wavelength (nm)", ylab = "Reflectance (%)", cex = 0.6, col = spec2rgb(procspec(as.rspec(coef_spline_reconstruction_plusintercept), fixneg = "zero")))
mtext("TanCyo", col = "blue", side = 3, line = 0.5, cex = 0.8)

par(mfrow=c(1,1), mar = c(5.1,4.1,4.1,2.1))


# Verification that our final spline reconstruction produces an identical color to the initial reflectance data and the gls reconstruction method

# Plot 1
rgb_colors[["TanCyo"]]
## [1] "#52574BFF"
# Plot 2
TanCyo$reflectance_rgb
## reflectance 
## "#52574BFF"
# Plot 3
spec2rgb(procspec(as.rspec(coef_spline_reconstruction), fixneg = "zero"))
## reflectance 
## "#303F2EFF"
# Plot 4
spec2rgb(procspec(as.rspec(coef_spline_reconstruction_plusintercept), fixneg = "zero"))
## reflectance 
## "#52574BFF"

Thus, we have shown we have accurately recreated the spline from our gls model and can produce identical colors to that of the original data just from the spline coefficients for a species and by using a basis for the trait data.

Step 14: What do the coefficients mean?

In the last step, we were able to reconstruct what the splines were through the use of a basis (wavelengths from 300-700 nm) and spline coefficients. We were able to deduce that the intercept was the key component to maintaining the biological meaning to our splines if ran through BEAST. Here we attempt to identify the function of the different spline coefficients through the case study of TanCyo.

# Taking our matrix created from bSpline and turning it into a matrix object
basis_spline_matrix <- matrix(bspline_matrix_bSpline, nrow = 401, ncol = 38)

# Turning our TanCyo reflectance coefficients into a 38x1 matrix
spline_coefficient_matrix <- matrix(TanCyo$reflectance_coef[2:39])

# Multiplying the matrices using the matrix multiplication operator (%*%)
spline_reconstruction <- basis_spline_matrix %*% spline_coefficient_matrix

# Verification that this matrix multiplication is how we are getting our curves through the spline functions (does not include the addition of the intercept coefficient here although if the answer is TRUE, adding the intercept to both objects will still produce a TRUE output)
identical(c(spline_reconstruction), coef_spline_reconstruction$reflectance)
## [1] TRUE

IT’S JUST MATRIX MULTIPLICATION, I HAVE NO IDEA WHAT THE BIOLOGICAL INTERPRETATION OF THE COEFFICIENTS ARE BUT I DOUBT IT IS USEFUL TO TRY AND UNDERSTAND THEM OR TAKE MEANS OF THEM ETC. The real question at this stage is to identify what the basis matrix represents for our system, as it is not clear as to what it could represent. Are the spline coefficients just a scalar to shape the curve?

Step 15: What do spline coefficients do? What does the basis matrix mean?

TanCyo_spline_reconstruction <- cbind(300:700,predict(bspline_matrix_bSpline, coef = as.numeric(c(TanCyo_spline_coefficients[2:39]))))


plot(300:700, TanCyo_spline_reconstruction[,2])

TanCyo_adjusted_coefficients <- TanCyo_spline_coefficients[2:39]
print(TanCyo_spline_coefficients[21])
## bs(wl, df = 38)20 
##              5.37
TanCyo_adjusted_coefficients[20] <- TanCyo_adjusted_coefficients[20]+1

TanCyo_adjusted_coefficients <- cbind(300:700, predict(bspline_matrix_bSpline, coef = TanCyo_adjusted_coefficients))
plot(300:700, TanCyo_adjusted_coefficients[,2])

par(mfrow=c(1,2))
plot(300:700, TanCyo_spline_reconstruction[,2], pch = 19, main = "TanCyo Base Coef.")
plot(300:700, TanCyo_adjusted_coefficients[,2], pch = 19, main = "TanCyo Adjusted Coef.")

par(mfrow=c(1,1))

spline_coef_comparison <- cbind(predict(bspline_matrix_bSpline, coef = (c(TanCyo_spline_coefficients[2:39]))), c(TanCyo_adjusted_coefficients[,2]))
spline_coef_comparison <- cbind(300:700, spline_coef_comparison)

I do not think the basis matrix or the spline coefficients have any inherit biological information.

Step 16: Comparing our splines for mean reflectance data and mean spline coefficients

mean_reflectance_values <- NULL
for (i in 1:401){

  x <- i
  mean_reflectance_values[i] <- mean(tanData_filtered_wowl[,x])

}

random_number <- round(runif(1, min = 1, max = 401), 0)
mean_reflectance_values[random_number] == mean(tanData_filtered_wowl[,random_number])
## [1] TRUE
mean_reflectance_values <- cbind(300:700, mean_reflectance_values)

spline_fit_mean_reflectance <- gls(mean_reflectance_values[,2] ~ bs(mean_reflectance_values[,1], df = 38), correlation = corAR1(form = ~1))

mean_reflectance_values <- cbind(mean_reflectance_values, predict(spline_fit_mean_reflectance)) 

colnames(mean_reflectance_values) <- c("wl", "reflectance", "spline_fit")

plot(x = 300:700, y = mean_reflectance_values[,"reflectance"], xlab = "Wavelength (nm)", ylab = "Reflectance (%)", main = "Mean Reflectance Values", pch = 19, cex = 0.75)
lines(x = 300:700, y = mean_reflectance_values[,"spline_fit"], col = spec2rgb(procspec(as.rspec(mean_reflectance_values), fixneg = "zero")), lwd = 3)
## wavelengths found in column 1
## processing options applied:
## Negative value correction: converted negative values to zero

mean_spline_coefficients <- NULL
for (i in 1:39){
  
  x <- i+1
  
  mean_spline_coefficients[i] <- mean(spline_coef_data[,x])
  
}

random_number <- round(runif(1, min = 1, max = 39), 0)
mean_spline_coefficients[random_number] == mean(spline_coef_data[,random_number+1])
## [1] TRUE
mean_spline_coefficients_output <- cbind(300:700, predict(bspline_matrix_bSpline, coef = mean_spline_coefficients[2:39]))

colnames(mean_spline_coefficients_output) <- c("wl", "reflectance")

mean_spline_coefficients_output[,2] <- mean_spline_coefficients_output[,2] + mean_spline_coefficients[1]

plot(x = 300:700, y = mean_spline_coefficients_output[,"reflectance"], main = "Mean Spline Coefficients", xlab = "Wavelength (nm)", ylab = "Reflectance (%)", pch = 19, cex = 0.75)
lines(x = 300:700, y = mean_spline_coefficients_output[,"reflectance"], col = spec2rgb(procspec(as.rspec(mean_spline_coefficients_output), fixneg = "zero")), lwd = 3)
## wavelengths found in column 1
## processing options applied:
## Negative value correction: converted negative values to zero

spec2rgb(procspec(as.rspec(mean_reflectance_values), fixneg = "zero"))
## wavelengths found in column 1
## processing options applied:
## Negative value correction: converted negative values to zero
## reflectance  spline_fit 
## "#9E855AFF" "#9E855AFF"
spec2rgb(procspec(as.rspec(mean_spline_coefficients_output), fixneg = "zero"))
## wavelengths found in column 1
## processing options applied:
## Negative value correction: converted negative values to zero
## reflectance 
## "#9E855AFF"
par(mfrow=c(1,2))

plot(x = 300:700, y = mean_reflectance_values[,"reflectance"], xlab = "Wavelength (nm)", ylab = "Reflectance (%)", main = "Mean Reflectance Values", pch = 19, cex = 0.75)
lines(x = 300:700, y = mean_reflectance_values[,"spline_fit"], col = spec2rgb(procspec(as.rspec(mean_reflectance_values), fixneg = "zero")), lwd = 3)
## wavelengths found in column 1
## processing options applied:
## Negative value correction: converted negative values to zero
plot(x = 300:700, y = mean_spline_coefficients_output[,"reflectance"], main = "Mean Spline Coefficients", xlab = "Wavelength (nm)", ylab = "Reflectance (%)", pch = 19, cex = 0.75)
lines(x = 300:700, y = mean_spline_coefficients_output[,"reflectance"], col = spec2rgb(procspec(as.rspec(mean_spline_coefficients_output), fixneg = "zero")), lwd = 3)
## wavelengths found in column 1
## processing options applied:
## Negative value correction: converted negative values to zero

par(mfrow=c(1,1))

Step 17: Plotting basis functions

What do the basis functions mean? Do they have the same wavelength width? How do they relate to the basis matrix? How are they represented?

Reference: https://math.stackexchange.com/questions/699113/what-is-the-relationship-between-cubic-b-splines-and-cubic-splines

Plotting the basis functions

basis_functions <- matrix(bspline_matrix_bSpline, nrow = 401, ncol = 38)


plot(x = 300:700, y = basis_functions[,1], ylim = c(0,1), pch = 19, col = "white")
for (i in 1:38){
  x <- i
  lines(x = 300:700, y = basis_functions[,x], lwd = 3, col = i)
}

Why are the basis functions not equivalent in size, and why does the last basis function look completely different from the other basis functions?

basis_function_width <- NULL

for (i in 1:38){
  
  x <- i
  
  basis_function <- c(bspline_matrix_bSpline[,x])
  
  basis_function[basis_function == 0] <- NA
  
  print(length(na.omit(basis_function)))
  
  basis_function_width[i] <- length(na.omit(basis_function))

}
## [1] 22
## [1] 33
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 45
## [1] 45
## [1] 45
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 45
## [1] 45
## [1] 45
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 45
## [1] 45
## [1] 45
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 44
## [1] 33
## [1] 22
## [1] 12
plot(x = 1:38, y = basis_function_width, main = "Basis Function Widths", col = "red", pch = 19, ylab = "Wavelength Width (nm)", xlab = "Basis Function")

z <- bSpline(300:700, df = 38, degree = 0)
wavelength <- NULL
basis_function_value <- NULL
for (i in 1:38){
  
  x <- i
  
  basis_function <- c(z[,x])
  
  basis_function <- cbind(300:700, basis_function)
  
  basis_function[basis_function == 0] <- NA
  
  print(length(na.omit(basis_function)))
  
  basis_function <- (na.omit(basis_function))
  
  wavelength <- c(wavelength, basis_function[,1])
  
  basis_function_value <- c(basis_function_value, basis_function[,2])
  
}
## [1] 20
## [1] 20
## [1] 22
## [1] 20
## [1] 20
## [1] 20
## [1] 22
## [1] 20
## [1] 20
## [1] 20
## [1] 22
## [1] 20
## [1] 20
## [1] 20
## [1] 22
## [1] 20
## [1] 20
## [1] 20
## [1] 22
## [1] 20
## [1] 20
## [1] 20
## [1] 22
## [1] 20
## [1] 20
## [1] 20
## [1] 22
## [1] 20
## [1] 20
## [1] 20
## [1] 22
## [1] 20
## [1] 20
## [1] 20
## [1] 22
## [1] 20
## [1] 20
## [1] 22
plot(z)

Why there are no values from 300:311 is still unknown. Plausible answer is that the basis functions start at the first internal knot and not the first boundary knot.

Reference: Yadav et al. 2020 (“A Review on XIGA method for computational fracture mechanics applications”)

y <- cbind(wavelength, basis_function_value)

y[y == 0] <- NA

y <- na.omit(y)

y
##        wavelength basis_function_value
##   [1,]        311                    1
##   [2,]        312                    1
##   [3,]        313                    1
##   [4,]        314                    1
##   [5,]        315                    1
##   [6,]        316                    1
##   [7,]        317                    1
##   [8,]        318                    1
##   [9,]        319                    1
##  [10,]        320                    1
##  [11,]        321                    1
##  [12,]        322                    1
##  [13,]        323                    1
##  [14,]        324                    1
##  [15,]        325                    1
##  [16,]        326                    1
##  [17,]        327                    1
##  [18,]        328                    1
##  [19,]        329                    1
##  [20,]        330                    1
##  [21,]        331                    1
##  [22,]        332                    1
##  [23,]        333                    1
##  [24,]        334                    1
##  [25,]        335                    1
##  [26,]        336                    1
##  [27,]        337                    1
##  [28,]        338                    1
##  [29,]        339                    1
##  [30,]        340                    1
##  [31,]        341                    1
##  [32,]        342                    1
##  [33,]        343                    1
##  [34,]        344                    1
##  [35,]        345                    1
##  [36,]        346                    1
##  [37,]        347                    1
##  [38,]        348                    1
##  [39,]        349                    1
##  [40,]        350                    1
##  [41,]        351                    1
##  [42,]        352                    1
##  [43,]        353                    1
##  [44,]        354                    1
##  [45,]        355                    1
##  [46,]        356                    1
##  [47,]        357                    1
##  [48,]        358                    1
##  [49,]        359                    1
##  [50,]        360                    1
##  [51,]        361                    1
##  [52,]        362                    1
##  [53,]        363                    1
##  [54,]        364                    1
##  [55,]        365                    1
##  [56,]        366                    1
##  [57,]        367                    1
##  [58,]        368                    1
##  [59,]        369                    1
##  [60,]        370                    1
##  [61,]        371                    1
##  [62,]        372                    1
##  [63,]        373                    1
##  [64,]        374                    1
##  [65,]        375                    1
##  [66,]        376                    1
##  [67,]        377                    1
##  [68,]        378                    1
##  [69,]        379                    1
##  [70,]        380                    1
##  [71,]        381                    1
##  [72,]        382                    1
##  [73,]        383                    1
##  [74,]        384                    1
##  [75,]        385                    1
##  [76,]        386                    1
##  [77,]        387                    1
##  [78,]        388                    1
##  [79,]        389                    1
##  [80,]        390                    1
##  [81,]        391                    1
##  [82,]        392                    1
##  [83,]        393                    1
##  [84,]        394                    1
##  [85,]        395                    1
##  [86,]        396                    1
##  [87,]        397                    1
##  [88,]        398                    1
##  [89,]        399                    1
##  [90,]        400                    1
##  [91,]        401                    1
##  [92,]        402                    1
##  [93,]        403                    1
##  [94,]        404                    1
##  [95,]        405                    1
##  [96,]        406                    1
##  [97,]        407                    1
##  [98,]        408                    1
##  [99,]        409                    1
## [100,]        410                    1
## [101,]        411                    1
## [102,]        412                    1
## [103,]        413                    1
## [104,]        414                    1
## [105,]        415                    1
## [106,]        416                    1
## [107,]        417                    1
## [108,]        418                    1
## [109,]        419                    1
## [110,]        420                    1
## [111,]        421                    1
## [112,]        422                    1
## [113,]        423                    1
## [114,]        424                    1
## [115,]        425                    1
## [116,]        426                    1
## [117,]        427                    1
## [118,]        428                    1
## [119,]        429                    1
## [120,]        430                    1
## [121,]        431                    1
## [122,]        432                    1
## [123,]        433                    1
## [124,]        434                    1
## [125,]        435                    1
## [126,]        436                    1
## [127,]        437                    1
## [128,]        438                    1
## [129,]        439                    1
## [130,]        440                    1
## [131,]        441                    1
## [132,]        442                    1
## [133,]        443                    1
## [134,]        444                    1
## [135,]        445                    1
## [136,]        446                    1
## [137,]        447                    1
## [138,]        448                    1
## [139,]        449                    1
## [140,]        450                    1
## [141,]        451                    1
## [142,]        452                    1
## [143,]        453                    1
## [144,]        454                    1
## [145,]        455                    1
## [146,]        456                    1
## [147,]        457                    1
## [148,]        458                    1
## [149,]        459                    1
## [150,]        460                    1
## [151,]        461                    1
## [152,]        462                    1
## [153,]        463                    1
## [154,]        464                    1
## [155,]        465                    1
## [156,]        466                    1
## [157,]        467                    1
## [158,]        468                    1
## [159,]        469                    1
## [160,]        470                    1
## [161,]        471                    1
## [162,]        472                    1
## [163,]        473                    1
## [164,]        474                    1
## [165,]        475                    1
## [166,]        476                    1
## [167,]        477                    1
## [168,]        478                    1
## [169,]        479                    1
## [170,]        480                    1
## [171,]        481                    1
## [172,]        482                    1
## [173,]        483                    1
## [174,]        484                    1
## [175,]        485                    1
## [176,]        486                    1
## [177,]        487                    1
## [178,]        488                    1
## [179,]        489                    1
## [180,]        490                    1
## [181,]        491                    1
## [182,]        492                    1
## [183,]        493                    1
## [184,]        494                    1
## [185,]        495                    1
## [186,]        496                    1
## [187,]        497                    1
## [188,]        498                    1
## [189,]        499                    1
## [190,]        500                    1
## [191,]        501                    1
## [192,]        502                    1
## [193,]        503                    1
## [194,]        504                    1
## [195,]        505                    1
## [196,]        506                    1
## [197,]        507                    1
## [198,]        508                    1
## [199,]        509                    1
## [200,]        510                    1
## [201,]        511                    1
## [202,]        512                    1
## [203,]        513                    1
## [204,]        514                    1
## [205,]        515                    1
## [206,]        516                    1
## [207,]        517                    1
## [208,]        518                    1
## [209,]        519                    1
## [210,]        520                    1
## [211,]        521                    1
## [212,]        522                    1
## [213,]        523                    1
## [214,]        524                    1
## [215,]        525                    1
## [216,]        526                    1
## [217,]        527                    1
## [218,]        528                    1
## [219,]        529                    1
## [220,]        530                    1
## [221,]        531                    1
## [222,]        532                    1
## [223,]        533                    1
## [224,]        534                    1
## [225,]        535                    1
## [226,]        536                    1
## [227,]        537                    1
## [228,]        538                    1
## [229,]        539                    1
## [230,]        540                    1
## [231,]        541                    1
## [232,]        542                    1
## [233,]        543                    1
## [234,]        544                    1
## [235,]        545                    1
## [236,]        546                    1
## [237,]        547                    1
## [238,]        548                    1
## [239,]        549                    1
## [240,]        550                    1
## [241,]        551                    1
## [242,]        552                    1
## [243,]        553                    1
## [244,]        554                    1
## [245,]        555                    1
## [246,]        556                    1
## [247,]        557                    1
## [248,]        558                    1
## [249,]        559                    1
## [250,]        560                    1
## [251,]        561                    1
## [252,]        562                    1
## [253,]        563                    1
## [254,]        564                    1
## [255,]        565                    1
## [256,]        566                    1
## [257,]        567                    1
## [258,]        568                    1
## [259,]        569                    1
## [260,]        570                    1
## [261,]        571                    1
## [262,]        572                    1
## [263,]        573                    1
## [264,]        574                    1
## [265,]        575                    1
## [266,]        576                    1
## [267,]        577                    1
## [268,]        578                    1
## [269,]        579                    1
## [270,]        580                    1
## [271,]        581                    1
## [272,]        582                    1
## [273,]        583                    1
## [274,]        584                    1
## [275,]        585                    1
## [276,]        586                    1
## [277,]        587                    1
## [278,]        588                    1
## [279,]        589                    1
## [280,]        590                    1
## [281,]        591                    1
## [282,]        592                    1
## [283,]        593                    1
## [284,]        594                    1
## [285,]        595                    1
## [286,]        596                    1
## [287,]        597                    1
## [288,]        598                    1
## [289,]        599                    1
## [290,]        600                    1
## [291,]        601                    1
## [292,]        602                    1
## [293,]        603                    1
## [294,]        604                    1
## [295,]        605                    1
## [296,]        606                    1
## [297,]        607                    1
## [298,]        608                    1
## [299,]        609                    1
## [300,]        610                    1
## [301,]        611                    1
## [302,]        612                    1
## [303,]        613                    1
## [304,]        614                    1
## [305,]        615                    1
## [306,]        616                    1
## [307,]        617                    1
## [308,]        618                    1
## [309,]        619                    1
## [310,]        620                    1
## [311,]        621                    1
## [312,]        622                    1
## [313,]        623                    1
## [314,]        624                    1
## [315,]        625                    1
## [316,]        626                    1
## [317,]        627                    1
## [318,]        628                    1
## [319,]        629                    1
## [320,]        630                    1
## [321,]        631                    1
## [322,]        632                    1
## [323,]        633                    1
## [324,]        634                    1
## [325,]        635                    1
## [326,]        636                    1
## [327,]        637                    1
## [328,]        638                    1
## [329,]        639                    1
## [330,]        640                    1
## [331,]        641                    1
## [332,]        642                    1
## [333,]        643                    1
## [334,]        644                    1
## [335,]        645                    1
## [336,]        646                    1
## [337,]        647                    1
## [338,]        648                    1
## [339,]        649                    1
## [340,]        650                    1
## [341,]        651                    1
## [342,]        652                    1
## [343,]        653                    1
## [344,]        654                    1
## [345,]        655                    1
## [346,]        656                    1
## [347,]        657                    1
## [348,]        658                    1
## [349,]        659                    1
## [350,]        660                    1
## [351,]        661                    1
## [352,]        662                    1
## [353,]        663                    1
## [354,]        664                    1
## [355,]        665                    1
## [356,]        666                    1
## [357,]        667                    1
## [358,]        668                    1
## [359,]        669                    1
## [360,]        670                    1
## [361,]        671                    1
## [362,]        672                    1
## [363,]        673                    1
## [364,]        674                    1
## [365,]        675                    1
## [366,]        676                    1
## [367,]        677                    1
## [368,]        678                    1
## [369,]        679                    1
## [370,]        680                    1
## [371,]        681                    1
## [372,]        682                    1
## [373,]        683                    1
## [374,]        684                    1
## [375,]        685                    1
## [376,]        686                    1
## [377,]        687                    1
## [378,]        688                    1
## [379,]        689                    1
## [380,]        690                    1
## [381,]        691                    1
## [382,]        692                    1
## [383,]        693                    1
## [384,]        694                    1
## [385,]        695                    1
## [386,]        696                    1
## [387,]        697                    1
## [388,]        698                    1
## [389,]        699                    1
## [390,]        700                    1
for (i in 1:401){
  
  x <- i
  
  bspline_matrix_bSpline[x,]
  
}

How do the basis functions change depending on the spline coefficients?

scalar_values <- c(-0.01, 0, 0.01, 0.1, 1, 2)

length(scalar_values)
## [1] 6
for (i in 1:length(scalar_values)){
  
  x <- matrix(rep(scalar_values[i], 38), nrow = 38, ncol = 1)
  
  warped_basis_functions <- c(basis_functions %*% x)
  
  print(warped_basis_functions)
  
  plot(x = 300:700, warped_basis_functions, main = paste("Spline Coefficients = ", scalar_values[i], sep = ''))
  
}
##   [1]  0.00000000 -0.00246429 -0.00448632 -0.00610983 -0.00737856 -0.00833625
##   [7] -0.00902664 -0.00949347 -0.00978048 -0.00993141 -0.00999000 -0.00999999
##  [13] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [19] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [25] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [31] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [37] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [43] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [49] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [55] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [61] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [67] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [73] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [79] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [85] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [91] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
##  [97] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [103] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [109] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [115] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [121] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [127] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [133] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [139] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [145] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [151] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [157] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [163] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [169] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [175] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [181] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [187] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [193] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [199] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [205] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [211] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [217] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [223] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [229] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [235] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [241] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [247] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [253] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [259] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [265] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [271] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [277] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [283] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [289] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [295] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [301] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [307] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [313] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [319] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [325] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [331] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [337] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [343] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [349] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [355] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [361] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [367] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [373] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [379] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [385] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [391] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000
## [397] -0.01000000 -0.01000000 -0.01000000 -0.01000000 -0.01000000

##   [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
##  [38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
##  [75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [112] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [149] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [186] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [223] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [260] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [297] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [334] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## [371] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

##   [1] 0.00000000 0.00246429 0.00448632 0.00610983 0.00737856 0.00833625
##   [7] 0.00902664 0.00949347 0.00978048 0.00993141 0.00999000 0.00999999
##  [13] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [19] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [25] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [31] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [37] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [43] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [49] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [55] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [61] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [67] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [73] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [79] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [85] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [91] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
##  [97] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [103] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [109] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [115] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [121] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [127] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [133] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [139] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [145] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [151] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [157] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [163] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [169] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [175] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [181] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [187] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [193] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [199] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [205] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [211] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [217] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [223] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [229] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [235] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [241] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [247] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [253] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [259] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [265] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [271] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [277] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [283] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [289] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [295] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [301] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [307] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [313] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [319] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [325] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [331] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [337] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [343] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [349] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [355] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [361] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [367] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [373] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [379] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [385] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [391] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000
## [397] 0.01000000 0.01000000 0.01000000 0.01000000 0.01000000

##   [1] 0.0000000 0.0246429 0.0448632 0.0610983 0.0737856 0.0833625 0.0902664
##   [8] 0.0949347 0.0978048 0.0993141 0.0999000 0.0999999 0.1000000 0.1000000
##  [15] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [22] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [29] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [36] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [43] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [50] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [57] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [64] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [71] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [78] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [85] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [92] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
##  [99] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [106] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [113] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [120] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [127] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [134] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [141] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [148] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [155] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [162] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [169] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [176] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [183] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [190] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [197] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [204] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [211] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [218] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [225] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [232] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [239] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [246] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [253] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [260] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [267] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [274] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [281] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [288] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [295] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [302] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [309] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [316] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [323] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [330] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [337] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [344] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [351] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [358] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [365] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [372] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [379] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [386] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [393] 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000 0.1000000
## [400] 0.1000000 0.1000000

##   [1] 0.000000 0.246429 0.448632 0.610983 0.737856 0.833625 0.902664 0.949347
##   [9] 0.978048 0.993141 0.999000 0.999999 1.000000 1.000000 1.000000 1.000000
##  [17] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
##  [25] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
##  [33] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
##  [41] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
##  [49] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
##  [57] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
##  [65] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
##  [73] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
##  [81] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
##  [89] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
##  [97] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [105] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [113] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [121] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [129] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [137] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [145] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [153] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [161] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [169] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [177] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [185] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [193] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [201] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [209] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [217] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [225] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [233] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [241] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [249] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [257] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [265] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [273] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [281] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [289] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [297] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [305] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [313] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [321] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [329] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [337] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [345] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [353] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [361] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [369] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [377] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [385] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [393] 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
## [401] 1.000000

##   [1] 0.000000 0.492858 0.897264 1.221966 1.475712 1.667250 1.805328 1.898694
##   [9] 1.956096 1.986282 1.998000 1.999998 2.000000 2.000000 2.000000 2.000000
##  [17] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
##  [25] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
##  [33] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
##  [41] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
##  [49] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
##  [57] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
##  [65] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
##  [73] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
##  [81] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
##  [89] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
##  [97] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [105] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [113] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [121] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [129] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [137] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [145] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [153] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [161] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [169] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [177] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [185] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [193] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [201] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [209] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [217] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [225] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [233] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [241] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [249] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [257] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [265] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [273] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [281] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [289] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [297] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [305] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [313] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [321] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [329] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [337] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [345] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [353] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [361] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [369] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [377] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [385] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [393] 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000 2.000000
## [401] 2.000000

for (i in 1:401){
  x <- i
  print(sum(basis_functions[x,]))
  
}
## [1] 0
## [1] 0.246429
## [1] 0.448632
## [1] 0.610983
## [1] 0.737856
## [1] 0.833625
## [1] 0.902664
## [1] 0.949347
## [1] 0.978048
## [1] 0.993141
## [1] 0.999
## [1] 0.999999
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1
## [1] 1

Each row (13+) has a sum of 1. Why do the previous rows not sum to 1, especially when there appears to be symmetry within the basis functions? Why do the columns sum to 1?

Spline coefficients act as scalar values to warp the magnitude of each point on the basis function.

Step 18: Showing how the spline coefficients and basis matrix works

TanCya <- spline_results[["TanCya"]]

TanCya_spline_coef <- TanCya$reflectance_coef

for (i in 2:39){
  
  x <- i
  
  sequence <- 2:i
  
  y <- i-1
  
  spline_coef_subset <- matrix(TanCya_spline_coef[sequence])
  
  basis_matrix_subset <- matrix(bspline_matrix_bSpline[,(1:y)], nrow = 401, ncol = y)
  
  spline_recon_subset <- basis_matrix_subset %*% spline_coef_subset
  
  plot(x = 300:700, y = spline_recon_subset + TanCya_spline_coef[1], ylim = c(0, 75), pch = 19, col = TanCya$reflectance_rgb, main = paste("Spline Coefficient =<", i-1), ylab = "Reflectance (%)", xlab = "Wavelength (nm)")
  
}

Step 19: Fitting cubic functions to spline data

This chunk of code is to confirm how the splines work. Current idea of how the math works. For some domain x (wavelength: 300:700), we create a series of basis functions (\(F_k(x)\)) that can be transformed by spline coefficients (\(c_k\)). Thus, each point (x) can be defined as follows: N(x) = \(\sum_{n=1}^k c_k*F_k(x)\). The output of the basis function transformation will create a piecewise polynomial of cubic functions.

2